My dummy programming language that compiles specific syntax arithmetical expressions to JavaScript expressions. I just did this as compilers training.
- sub - Subtract
- sum - Sum
- mult - Multiply
- div - Divide
(operator ...args[] | (operator ...args[]))
(sum 2 (sub 4 3 1)) // Equivalent to (4 - 3 - 1 ) + 2
npm install
Path: ./examples/simple.dml
Content:
(sum 2 (sub 4 3 1))
npm run compile ./examples/simple.dml
Path: ./examples/simple.js
Content:
2 + (4 - 3 - 1);
Path: ./examples/simple.dml
Content:
(sum 2 (sub 4 3 1))
npm run execute ./examples/simple.dml
2023-08-17T19:44:34.064Z Source file ./examples/simple.dml execution started
2023-08-17T19:44:34.067Z Compilation process started
2023-08-17T19:44:34.067Z Reading source file...
2023-08-17T19:44:34.067Z Source file successfully read. Compiling content...
2023-08-17T19:44:34.067Z Compilation process finished. Took 0.48ms
2023-08-17T19:44:34.068Z Source file execution finished. Took 0.57ms. Result: 2