- Operators and primitive types.
- Data types - boolean, int, float, double, string.
- Operators - assignment, ternary, if-else, for, while.
- Supports code with user input prompts (read).
- Comparison operators <, <=, >, >=, == are implemented.
- Single line comments can be made anywhere in the code.
- Int and float datatypes are supported.
- Paranthesis in expression assignment.
Sample CodeZilla code(.cz) to add two numbers:
#program to add two numbers
start;
var a;
var b;
var c;
c = 0;
read a endread;
read b endread;
c = a + b;
show << sum of two numbers is >> endshow;
show c endshow;
end;CodeZilla Output
Requirements:
- Python3
- SWIPL.
System on which compiler and runtime are built: Windows
Tool used: Python, Atom, SWIPL, SWI-SH
- Use the package manager pip to install libraries required for the lexical analyzer.
pip install sly
pip install simplejson- Import project folder in your local system.
- Create the CodeZilla (.cz) file in 'data' folder.
- In the 'src' folder, run the lexical analyzer as
python lexer.py- Input the desired file's name to generate the token (.tok) file in the 'data' folder.
- COMPILER: In the 'src/compiler' folder, execute the compiler in SWI Prolog to generate the parse tree (.pt) file in the 'data' folder.
?- codezilla('filename.tok')- RUN TIME: In the 'src/runtime' folder, execute the interpreter in SWI Prolog to evaluate the parse tree and obtain the output.
?- codezilla('filename.pt')- The output will be displayed in the SWI Prolog terminal.
Set up environment variables for:
- Python3
- SWIPL.
- Navigate to 'src/batch/' and open command prompt.
- Execute
runtime.bat- When prompted, input the desired file's name to obtain the output.
