AZHenley / teenytinycompiler

A small BASIC-to-C compiler written in Python.
MIT License
333 stars 47 forks source link

Thanks for inspiration #7

Open janrutger opened 1 year ago

janrutger commented 1 year ago

Thank you very much, I have used your inspiration to write a stack based toy language that works with my toy CPU instruction set.!!

program    ::=  {statement}
statement  ::=  "LABEL" ident nl
        |   "GOTO" ident nl
        |   "DEFINE" nl {statement} nl "AS" ident nl

        |   "{" (expression | st) "}" "REPEAT" nl {statement} nl "END" nl      

        |   (expression | st) ( 
                    "PRINT" nl
                    | "PLOT" nl
                    | "AS" ident nl
                    | "DO"   nl {statement} nl "END" nl
                    | "GOTO" ident nl
                    | nl )

expression ::=  (INTEGER | STRING | word | ident)+
word       ::=  ('+'|'-'|'*'|'/'|'%'|'=='|'!='|'>'|'<'|'GCD'|'!'|'DUP'|'SWAP'|'OVER'|'DROP'|'INPUT'|'RAWIN')
ident      ::=  STRING

st         ::=  ('.'|'..')
nl         ::= '\n'+
AZHenley commented 1 year ago

Awesome!!! Do you have a link to the repo?

janrutger commented 8 months ago

yes i do, its a little messy but no reason not to share https://github.com/janrutger/TurningVM/tree/mpu/TeenyStacks

dagimg-dot commented 6 months ago

I want to say thanks too. I managed to follow your blog series and build the compiler and also add features like modulo operator, functions and else statments. Thanks once again !!