Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.06 KB

README.md

File metadata and controls

30 lines (25 loc) · 1.06 KB

micro_compiler

Implementation in Java of a micro compiler including:

  • Constant and variable declaration.
  • Simple expressions.
  • Assignment instruction.
  • If-then-else condition.

The micro_compiler consists of 2 phases:
  1. Analysis phase, which includes:
    • Lexical analysis, using a pre-defined regular grammar.
    • Syntax analysis, using a context-free grammar.
    • Semantic analysis, using syntax directed translation.
  2. Code generation phase: which was integrated in the parser and generates a set of assembly code instructions.

EBNF representation of the syntax:

EBNF

Input:

input

Output:

output