Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTProject

Overview

This Mini Compiler implements a Level 3 grammar (Simple C3) - it parses and executes programs with variables, functions, expressions, control flow, and basic input/output.

Supported Features

Statements and control flow:

  • Variable declaration and assignment

  • Function declaration and calls with parameters and return values

  • if / else conditionals

  • while loops, including break and continue

  • printf and scanf for console I/O

Expressions and operators:

  • Arithmetic: +, -, *, /, %

  • Assignment: =, +=, -=, *=, /=, %=

  • Unary: - (negate), ++, -- (prefix and postfix)

  • Logical: &&, ||, !

  • Bitwise: &, |, ~

  • Comparison: <, <=, ==, !=, >=, >

Demo Programs and Tests

The project includes demo programs demonstrating variable handling, loops, conditionals, function calls, and I/O. Automated test cases verify that all language features work as expected.

  • To test the demo functions, just run the main class, and it will automatically compile and run them.
  • To run the test cases, just run the SimpleC1TestRunner or SimpleC3TestRunner class, and it will execute all the test cases and report any failures.

About

Mini Compiler: A lightweight C-like language compiler with support for variables, functions, control flow, and basic I/O

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages