CITS2002 Project1 Programming Language Interpreter
Linux / Unix
# under root directory of this project run:
make all # (or) make debug (or) make release (make test)
# It will build executable under /out/ directory
make clean # remove all the outpur under /out/
# under root directory of this project run:
make all
cd out
./test
./runml_debug ../test/filename
./runml_release ../test/filename
See test cases on project page. Using automatic testing, assert.
only a single runml.c
files.
Other files will not be submitted.
Requirements | Solutions See Functions: |
---|---|
1. |
endwith_semicolon |
2. |
LOGE |
3. |
LOGD |
4. |
is_intf, is_intd, ISINT, FMT, PRINT |
5. |
PRINT, only handle numbers |
6. |
is_valid_indentifier |
This is a precondition, they will ensure it. | |
8. |
is_cmdline_arg, translate_cmdline_arg |
9. |
startwith_tab |
10. |
struct Function |
11. |
check_file |
12. |
rm_comment |
13. |
|
14. |
Program runml should do the following:
- Read each line of the file
- Extract tokens from each line:
- keywords[function, return, arg0, arg1, '\t'],
- operands[x, y],
- operators[<-, +, *, (, ), ',', #, whitespace],
- variables[value, one],
- functions[print, increment],
- parameters[local para]
- types[real]
- Check new line syntax based on previous line tokens
- Write translated tokens to c code and format.
- Validates and Report any errors commencing with the ! character. (Must detect all invalid ml programs)
- Generate C11 code in a file name, for exmaple ml-$pid.c
- Compile ml-$pid.c
- Execute ./ml-$pid, passing any optional command-line arguments(real numbers)
- Removes any files that it created (cleanup).
See CONTRIBUTING.md