Skip to content

Bobrinik/golite-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoLite compiler

Team Members

About

Requirements

  • We are using flex and bison to build scanner and parser.
    • Annotated flex and bison example by akrolik
    • Excellent book on flex is flex & bison by John Levine
  • We are using make to build our project.
sudo apt install make flex bison

Building

cd src
make install

Running

# Run tests located in Programs directory
./test.sh 
# Run scanner on go string
printf "package main\n func main(){ println(\"Hello\")\n }" | ./golite scan

# Scan with the file
./golite scan < my_golite.go

# Parse
./golite parse < my_golite.go # outputs OK if the program is syntactically correct

# Symbol
./golite symbol < my_golite.go # outputs symbol table that is being built for the program

# Typecheck
./golite typecheck < my_golite.go # outputs ok if the program typechecks

# Codegen
./golite codegen generated_file_name < my_golite_to_tranlsate_from.go

Development

  • I found that Emacs has the best support for writing C code. I wish I knew about this back in the time when I took operating systems.
  • valgrind very useful when debugging segfault errors. Just follow installation instructions from their website.