Skip to content

Tolu2492/Pseudo-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pseudo-Compiler

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

Files

  • 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.

Run

  • 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

Environment

This project was developed and tested on Linux using GCC.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors