c84414b23c | ||
---|---|---|
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, string, char and functions
+ - * / %
arithmetic operators< > <= >= == != && || !
boolean operators- variables
if else
conditional,while
loop,break
andcontinue
keyword- functions as variables
- indexing for string
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
- print statement OK
- string / char => indexing OK / escaping OK
- local scope for { statements } OK
- array OK => len keyword OK
- read / write => file, standard io
- sleep
- program arguments
- tuple
- dict
- standard lib ?
- types declaration
- type checking before runtime
- types inference
- structs => methods (list container?)
- read / write => network sockets
- for loop and iterators NOK
- pow / bitwise / bitshift operators
- range
- import from other files
- ast unit tests
- check and enhance parsing error printing
playground
- compile time inclusion of the example program
- syntax color
- line numbers
- better panel title
- panel tabs
- print / string => language
- console for print
tools
- repl
- LLVM IR translation
- JIT
- compilation