Skip to content

jake-edmonstone/WLP4-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WLP4 Compiler

This project is a compiler from WLP4 (a small subset of C) to MIPS assembly language. A quick overview of WLP4 can be found here or the full specification, here. The compiler consists of four main components: a scanner, parser, type checker, and code generator. Each component is implemented as a separate C++ program.

Components

  • Scanner (smm and scan): Tokenizes the input source code.
  • Parser (parse): Analyzes the tokenized input and constructs a parse tree.
  • Type Checker (type): Validates the syntax tree against type rules.
  • Code Generator (gen): Generates target assembly from the validated syntax tree.

Usage

To compile the project, use the following commands:

make

This will create the following executables:

  • smm
  • scan
  • parse
  • type
  • gen

Each executable can be run individually, processing the output from the previous stage:

cat example.wlp4 | ./smm | ./scan | ./parse | ./type | ./gen

About

A compiler from WLP4 (a subset of C) to MIPS assembly language.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published