Skip to content

Basic implementation of a compiler (parser) that parses simple cpp syntax

License

Notifications You must be signed in to change notification settings

atanughosh01/basic-gcc-like-compiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

basic-gcc-like-compiler

Designing a C like compiler

File Structure

  • cmd - All commands. Must be run from root only
  • grammar - Grammar rules and descriptions
  • lexer - Lex file. Reads the input and writes the tokens to out/lex/<input filename>.tkl
  • parser - Parser program files
  • results - Parsing table, Transition graph, Graph visualization
  • symbol table - Symbol table generating program and writes the tokens to out/symbol table/<input filename>.csv
  • util - Utility Cpp program to prepare for read and write to files
  • out - Output files from the lexer, parser, and symbol table

Run

  • Use a bash like shell
  • Run ./run.sh
  • Individual commands may be run as ./cmd/<command>.sh

Individual Commands in "cmd" directory

  • lex.sh - Must be supplied with a file to lex
  • symboltable.sh - Must be supplied with a file to generate the symbol table
  • parse.sh - Run the parser
  • visualize.sh - Visualize the transition graph (saved in results/graph.svg)

Transitions

About

Basic implementation of a compiler (parser) that parses simple cpp syntax

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 82.0%
  • Lex 7.4%
  • Shell 5.3%
  • Python 3.7%
  • xBase 1.6%