BMM (or B--) is a toy programming language based on BASIC.
This is complete scanner and parser for BMM.
Ihita Sinha, 2021CSB1095
Niti Shyamsukha, 2021CSB1118
- BMM_Scanner.l : Scanner for BMM using flex
- BMM_Parser.y : Parser for BMM using bison
- CorrectSample.bmm : Correct sample code written in BMM
- IncorrectSample.bmm : Incorrect sample code writen in BMM
- README
To build the compiler for BMM, run the following commands:
$ lex BMM_Scanner.l
$ bison -d BMM_Parser.y
$ gcc lex.yy.c y.tab.c -o bb
To run the compiler for BMM, run the following commands:
$ bb test_file.bmm
Here, the test file can be any of the two provided in this directory. (CorrectSample.bmm and IncorrectSample.bmm)
Errors are shown in the format:
"Error in LINE : "
Here, is one of the following:
- Lowercase values not permitted
- DATA Statement must be in the form. DATA value1, value2, ..., valueN
- DEF expected FNX and assignment.
- LET expected assignment statement.
- END expected
- END expected.
- Line expected.
- Expected <\n>
- Cannot assign number to incompatible variable.
- Cannot assign string to incompatible variable.
- INPUT Statement must be in the form. INPUT value1, value2, ..., valueN
- PRINT Statement must be in the form. PRINT value1, value2, ..., valueN
- GOSUB expected Line Number.
- GOTO expected Line Number.
- Fatal, RETURN called without corresponding GOSUB.
- Expected all capitals comment.
- Expected IF THEN LINE_NUMBER
- Expected FOR TO [STEP ].
- Expected FOR TO
- Assigned Number to string variable.
- Undeclared identifier used.
- Incompatible identifier assigned to variable.
- Expected DIM var1(number), etc.
- Variable in NEXT statement not matching FOR statement.
- Line numbers must be ascending.
- [default] Syntax error in line