flavien 20a1c526e0 | ||
---|---|---|
src | ||
test_programs | ||
.DS_Store | ||
.gitignore | ||
.pre-commit-config.yaml | ||
Cargo.lock | ||
Cargo.toml | ||
README.md | ||
example.duck | ||
index.html |
README.md
Ducklang
A toy language to learn programming language.
Written in Rust with pest PEG parser.
Currently implemented:
- number (i64), boolean
+ - * / %
arithmetic operators< > <= >= == != && || !
boolean operators- variables
if else
conditional,while
loop,break
keyword
TODO playground
- compile time reading of the example file
- syntax color
- line numbers
- better panel title
- panel tabs
- print / string => language
- console for print
Example
/*
An example of program with most of
the supported features
*/
x = true;
z = 3 + 4 * (2 + 1); // good order of op
if (x) {
y = 5;
while (x) {
if (!y && z % 2) {
z = 8;
break;
} else if (y == 3) {
z = 5;
}
y = y - 1;
}
} else {
// never reached
y = -8;
x = true;
}
Final state of the program environment:
var: y => val: 0
var: x => val: true
var: z => val: 8
TODO
syntax
- functions OK
- strings
- print statement
- types declaration
- types inference
- array / list / string / map => iterators
- read / write
- program arguments
- structs
- import from other files
- refactor parsing error printing
- unit tests
tools
- repl
- LLVM IR translation
- JIT
- compilation