Implements a complete PL/0 compiler in C including:
- A lexical analyzer
- A recursive-descent parser and code generator
- A stack-based PM/0 virtual machine
lex.c— used to tokenize a given set of PL/0 code (does not act on errors) results produced in tokens.txt.parsercodegen.c— The token parser and code generator that takes in the tokenize PL/0 code and converts to P-machine code results produced in elf.txt.vm.c— Virtual machine used to run the produced P-machine code and construct a stack based architecture.
- gcc -O2 -std=c11 -o lex lex.c
- gcc -O2 -std=c11 -o parser parsercodegen.c
- gcc -O2 -std=c11 -o vm vm.c
Once compiled run each individually:
- ./lex input.txt
- ./parser
- ./vm elf.txt
Or can be ran through makefile
- make
- make run
- To reset: make clean
This project was developed and tested on Linux using GCC.