jask is a highly readable interpreter language in early development. The jask interpreter is fully written in C# without other dependencies. It is just a hobby project for fun and learning, contributions are always welcome!
The main goal is to keep the interpreter itself as small as possible and to implement only those functions internally that are truly necessary or that greatly affects performance. All other functions should be written directly in jask to explore and expand the language's capabilities. A brief summary of the properties of jask:
- dynamically typed variables (Variables are just a container for any kind of data)
- strongly typed values (jask enforces strict type checking)
- fully immutable (things in jask cannot mutate themselves, operations always creating copies)
- data and behaviour are separated (functions are not bound to anything, data is held separated)
Seeing jask for the the first time? Try the Getting started guide! For further information, please visit the Wiki. A collection of useful functions written in jask can be found at jcore.
This is a reimplementation of the jpaffrath/jask interpreter, making this version 2 of the jask language. I decided to rewrite the entire interpreter because the first version of jask was non-intuitive, very limited, very (very) slow and I wanted to dig deeper into learning C# and the dotnet framework.
set hello to "Hello, World!"
print(hello)
jask aims to be highly readable, easy to maintain, and understandable to beginners. The syntax largely avoids complex notation and is modeled after natural language.
A more complex example for a direct deep-dive:
struct Edible
set name to ""
set number to 0
set healthy to false
endstruct
function shouldIEatThis(edible: Edible)
print(edible->number + "x " + edible->name + "? ")
if edible->healthy == true
print("Yes, absolutely!")
else
print("Oh no, I'd rather not")
endif
print("\n")
end
set apple to Edible(name = "Apple", number = 2, healthy = true)
set pizza to Edible(name = "Pizza", number = 5)
set myEdibles to list(apple, pizza)
for edible in myEdibles
shouldIEatThis(edible)
endfor
This will output
2x Apple? Yes, absolutely!
5x Pizza? Oh no, I'd rather not
To use the interactive mode, invoke jask:
dotnet run
Exit the interactive mode with the exit command. jask can interpret files:
dotnet run examples/simple.jask