Go to file
Flavien Henrion c84414b23c feat(read_write): WIP read and write impl 2023-12-18 19:04:50 +01:00
src feat(read_write): WIP read and write impl 2023-12-18 19:04:50 +01:00
test_programs feat(read_write): WIP read and write impl 2023-12-18 19:04:50 +01:00
.DS_Store feat(read_write): WIP read and write impl 2023-12-18 19:04:50 +01:00
.gitignore feat(egui): egui app code init 2022-12-27 13:29:40 +01:00
.pre-commit-config.yaml feat(break-keyword): Break keyword impl + tests + pre-commit 2022-12-03 17:51:46 +01:00
Cargo.lock feat(read_write): WIP read and write impl 2023-12-18 19:04:50 +01:00
Cargo.toml feat(read_write): WIP read and write impl 2023-12-18 19:04:50 +01:00
README.md feat(read_write): WIP read and write impl 2023-12-18 19:04:50 +01:00
example.duck feat(string): string, chars and indexing 2023-12-11 22:18:33 +01:00
index.html feat(interpreter): interpreter with code editor UI 2023-01-03 17:38:54 +01:00

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 and continue 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