This project is a basic interpreter for a very simple language.
The syntax for this language is defined by the following grammar:
-> | |
-> : | display -> |
-> A | B | C | D | E -> | + | - | * | / -> |
-> |
-> |
-> 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0
Note:
=> space character => line feed character => carriage return character
Also,
- At most five variables can be defined in a program.
- The symbol, ':' is the assignment operator.
- It assigns the result of an expression to a variable.
Pre-requisites
- GCC
Instructions:
- Run the following command: gcc interpreter.c -std=c99 -o interpreter ./interpreter [PROGRAM_FILE_NAME]
File content:
A:1 B:A+0 display A
Output: 1
More sample programs in the samples directory.