Skip to content

Zengineers/cimple-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cimple Compiler

SUMMARY

Cimple is a simplified version of the C programming language with educational purposes.
Its capabilities are limited, however, it contains many well-known control flow statements.
Cimple program files have a .ci extension. A full language description can be found in the report
file (GR). The compiler was developed for the Compilers course @cse.uoi.gr and
the final code produced is in MIPS32 assembly.

CONTENTS

  • cimple.py: the compiler
  • cimple-test-files: various Cimple programs used for testing purposes
  • compilation-output: examples of the files created from the compilation
  • report: thorough project report.
  • cleanup.py: used to clean any unwanted files created from the compilation

EXECUTION

  • Run command: python3 cimple.py <cimple file> <optional arg>
    <cimple file>: the cimple program file path to be compiled ending in .ci
    <optional arg>: can be one of the following
       -lex: print lex tokens on screen
       -ic: print intermediate code quad on screen
       -st: print symbol table on screen
       -asm: print final assembly code on screen

  • By default the compiler creates 3 files:
      .int file with the intermediate code
      .sym file with the symbol table
      .asm file with the final MIPS assembly code

  • If the cimple program has no function or procedure an extra C file equivalent is created
    which contains the intermediate code quads as low level C code. (can be compiled with any C compiler)

  • The produced final code can be assembled and executed with MARS 4.5:
    MIPS Assembler and Runtime Simulator

LANGUAGE

Python 3.8.5

About

Cimple compiler developed for the Compilers course @cse.uoi.gr

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •