A transpiler for the Micro programming language.
For educational purposes only.
For more educations resources:
https://www.youtube.com/channel/UCGPpiPgghR8uiaIIJuvKZtg
https://twitter.com/jrdev_
Inspired by "Crafting a Compiler in C" by Charles N. Fisher & Richard J. LeBlanc, Jr.
Production | Rules |
---|---|
<program> | begin <statement list> end |
<statement list> | <statement> {<statement>} |
<statement> | ID = <expression>; |
<statement> | write ( <expression> ); |
<expression> | <primary> {<arithmetic op> <primary>} |
<primary> | ID |
<primary> | INTLITERAL |
<arithmetic op> | PLUSOP |
<arithmetic op> | MINUSOP |
-
update source code in source.micro
-
execute
npm run start
to transpile code -
run
node ./output/app.js
to execute transpiled code