A3E is a simple programming language compiler similar to C++ built using Flex and Bison and a simple GUI for testing.
- clone/download the repo
git clone https://github.com/AdelRizq/A3E - Open
gui.exe - Select your file and compile
-
Variables and constants declaration
-
Define variable: datatype id = value;
- Example:
int a = 5;
- Example:
-
Define constant: const datatype id = value;
- Example:
const int a = 5;
- Example:
-
-
Mathematical and Logical expressions
- Mathematical operations
- +, -, *, /, %
- Logical operations
- ||, &&, ^, !
- >, <, >=, <=
- Any level of parentheses/complexity.
- Mathematical operations
-
Assignment statements
- Variable = expression
- Example:
a = 5 * b + c;
- Example:
- Variable = expression
- If-endif, if-else statements
- While loops
- For loops
- Repeat until
- Switch case
- Block structures
| Quadruple | Description |
|---|---|
| ADD s1, s2, R | Pop the top 2 values of the stack (s1, s2) and push s1 + s2 |
| SUB s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push s1 - s2 |
| MUL s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push s1 * s2 |
| DIV s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push s1 / s2 |
| MOD s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push s1 % s2 |
| LT s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push true if s1 < s2 else false |
| GT s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push true if s1 > s2 else false |
| LE s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push true if s1 <= s2 else false |
| GE s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push true if s1 >= s2 else false |
| EQ s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push true if s1 == s2 else false |
| NE s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push true if s1 != s2 else false |
| NOT s1, r | Pop the top 2 values of the stack (s) and push !s |
| AND s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push true if s1 && s2 |
| OR s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push true if s1 |
| XOR s1, s2, r | Pop the top 2 values of the stack (s1, s2) and push s1 ^ s2 |
| PUSH value | Push value to the stack |
| POP dst | Pop the top of the stack in into dst |
| L: | Add label with number num |
| JMP L | Unconditional jump to L |
| JZ L | Jump to L if stack top == 0 |
| B: | Add break label with the scope number |
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b AmazingFeature-Feat) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin AmazingFeature-Feat) - Open a Pull Request
- Thanks goes to these awesome people in the team.
Eman Othman |
Adel Rizq |
Abdallah Hemdan |
Ahmed Mahboub |
- This software is licensed under MIT License, See License for more information.








