Skip to content

CMinusCompiler - simplified compiler for C-minus

Notifications You must be signed in to change notification settings

sfmqrb/compiler

Repository files navigation

Welcome to my compiler project 👋

Description of the project's different phases:

phase 1

Scanner

A scanner is a program that takes a sequence of characters (the source file of the program) and produces a sequence of tokens that will be used to feed the compiler's parser.

A file called "input.txt" contains the raw code. Also, this file is in the same directory as compiler.py.

phase 2

Parser

A parser is a compiler or interpreter component that breaks data into smaller elements for easy translation into another language. In this project we implemented a recursive descent parser.A recursive descent parser is a kind of top-down parser built from a set of mutually recursive procedures (or a non-recursive equivalent) where each such procedure implements one of the nonterminals of the grammar.

  • parse tree

  • panic mode

phase 3

Code Generator

Generate intermediate code which is relatively close to assembly language.

  • handle recursive functions

Run

pip install -r requirements.txt
make run

Interpreter

Put output.txt file in interpreter directory and run ./tester_<YOUR_OPERATING_SYSTEM>

Debugging

For program to create symbol_table, lexical_errors, syntax_errors and parse_tree in the path tools/Development.py set develop_mode = True.

Code Contributors

Project's code is written by contributors

About

CMinusCompiler - simplified compiler for C-minus

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published