No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 6af2316 Dec 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
basicc Advancements on syntax Dec 9, 2018
examples Advancements on syntax Dec 9, 2018
misc Improve number tokenization; advance syntax pass Dec 2, 2018
.gitignore Fix tokenizer and add test Oct 18, 2018
Makefile Advancements on syntax Dec 9, 2018
README.md Fix typo in project name Dec 8, 2018

README.md

pcs3866-languages-and-compilers

A Darthmouth BASIC compiler, written in the Pony language. Ponyc 0.25.0 is required.

Wirth notation of the language:

Program = BStatement { BStatement } int "END" .
BStatement = int ( Assign | Read | Data | Print | Goto | If | For | Next | Dim | Def | Gosub | Return | Remark ) .
Assign = "LET" Var "=" Exp .
Var = letter digit | letter [ "(" Exp { "," Exp } ")" ] .
Exp = { "+" | "-" } Eb { ( "+" | "-" | "*" | "/" | "^" ) Eb } .
Eb = "(" Exp ")" | Num | Var | ( "FN" letter | Predef ) "(" Exp ")" .
Predef = "SIN" | "COS" | "TAN" | "ATN" | "EXP" | "ABS" | "LOG" | "SQR" | "INT" | "RND" .
Read = "READ" Var { "," Var } .
Data = "DATA" Snum { "," Snum } .
Print = "PRINT" [ Pitem { "," Pitem } [ "," ] ].
Pitem = Exp | """ Character { Character } """ [ Exp ] .
Goto = ( "GOTO" | "GO" "TO" ) int .
If = "IF" Exp ( ">=" | ">" | "<>" | "<" | "<=" | "=" ) Exp "THEN" int .
For = "FOR" letter [ digit ] "=" Exp "TO" Exp [ "STEP" Exp ] .
Next = "NEXT" letter [ digit ] .
Dim = "DIM" letter "(" int { "," int } ")" { "," letter "(" int { "," int } ")" } .
Def = "DEF" "FN" letter "(" letter [ digit ] ")" "=" Exp .
Gosub = "GOSUB" int .
Return = "RETURN" .
Remark = "REM" { Character } .
Int = digit { digit } .
Num = ( Int [ "." { digit } ] | "." Int ) [ "E" [ "+" | "-" ] Int ] .
Snum = [ "+" | "-" ] Num .
Character = letter | digit | special .