Necklace is a tiny, imperative, statically, strongly typed language with Elixir-like syntax.
- ints and bool types
- pointer support
- while loops
- if statements
- Engineering & Language Design: @MaksymilianDemitraszek @pagmerek
- Testing: @Qqkyu
function main do
a: bool;
b: int;
b = 5;
while (b > 0) do
printInt(b);
b = b - 1;
end
return;
end
You can find more examples in examples/
and more detailed documentation in documentation/docs.pdf
Test are located in test/
dir. To run them on your machine run
stack test
- llvm9 on you linux machine
- If llvm-hs does not detect llvm-config-9 you can symlink it as llvm-conifg and add it to the PATH.
You need installed llvm9 and stack
$ stack install alex happy
$ stack install
$ stack run necklace-exe `<file_name>.nck`
stack should rebuild lexer and parser on run, but if you need to do it by hand you can do
alex src/Compiler/Lexer.x -o src/Compiler/Lexer.hs
happy src/Compiler/Parser.y -o src/Compiler/Parser.hs
Run all tests
./shelltest.sh
Run tests under one directory
./shelltest.sh <directory_name>
- floats
- structs
bind <variable> <function>
statement, which binds given function to a variable. After that whenever that variable changes, that function runs