This repository is for the group project of SER502. Compiler and Virtual Machine for a Programming Language.
The compiler is called 'bumpy'.
The github link to the language is: https://github.com/maddymz/SER502-Spring2019-Team11 The link of the youtube video is: https://youtu.be/MjIn-Y3p1kE
Compiler is built on Windows OS.
The src (source folder) consists of the following folders - compiler and runtime.
compiler/- consists of lexer_parser.pl file. It consists of the tokenizer which is used togenerate tokens for .bmy code and also defines the parser of our language which consumes the tokens to generate the parse tree. The parse tree is stored which is output to the .bmic file (intermediate code). compiler/- also consists of interpreter.pl which takes the input as .bmic file and generates the output for the given .bmy code. runtime/- contains of bumpy.pl whic is the combination of lexer_parser & interpreter and executes the whole program at once.
Requires SWI-Prolog 8.0.2 to be installed on the computer. Visit http://www.swi-prolog.org/download/stable and download according to your system.
- Download the repository to your local system.
- Open the SWI-Prolog runtime environment.
- Consult src/runtime/bumpy.pl by going into File-> Consult and selecting the file.
- Run - bumpy('<FILEPATH/Filename.bmy>').
- This will generate an intermediate code file with .bmic extension in the data folder and execute the code.
- SWI-Prolog 8.0.2
- Online SWI Coder (https://swish.swi-prolog.org/).
- Sublime Text 3.
- Flashback Express Recorder.
- Adobe Premiere Pro.
- Implemented operators and primitive types boolean, var.
- Support for Assigment statments and evaluation of expressions.
- incase-do-otherwise-endcase construct to make decisions.
- when-do-endrepeat statement to do iterative execution.
- Generates intermediate code (parsetree) and saves it to a .bmic file.
- Interpreter takes .bmic file as input and prints the ouput on the Prolog runtime environment.
- Single line comments can be made at the begining of the code using @.
- Reading the user inputs from the console
- Conditional operators 'and', 'or', 'not' are implemented.
- Comparision operators '>' | '<' | '<=' | '>=' | ':=:'(equals) | '~='(not equals) are implemented.
- Print statements can be used as a. "show printthis'" & can also print expressions after evaluating them.
- Conditional construct 'incase-do-otherwise-endcase' and looping construct 'when-do-endrepeat' are implemented.
- Nesting of multiple 'incase-do-otherwise-endcase', multiple 'when-do-endrepeat', 'while do' within 'If then else' are implemented.
- Evaluation of arithmetic and boolean expressions.
- Boolean expressions can be used in the conditions.
- Multiple conditions can be checked using and/or.
- Support of assignment for boolean expressions.
- User input needs to be followed by a '.' & Enter.
- Cannot input any string (String functions are not supported).
- Comments are added only at the top of the program between @...@.
- Language is case sensitive and only supports lowercase identifiers.
- Declaration of the variables can be done only at the start of the block.
- Palak Chugh - Githubaccount
- Yuti Desai - Githubaccount
- Bharat Goel - Githubaccount
- Madhukar Raj - Githubaccount