Skip to content

Jean-Baptiste-DP/Compiler-Yacc-Lex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language compiler with Lex and Yacc

Running the project

bison -d yaccLex/compiler.y
flex yaccLex/compiler.l
gcc -o compiler compiler.tab.c lex.yy.c src/*.c src/*/*.c
./compiler examples/exFunction.txt

Once the compiler file is compile, you can only run the last line to execute your program.

It's also possible to run the program line by line (like while executing "python3") with :

./compiler

Feature

Currently, the program is only supporting types int, boolean and float. The program is able to do :

  • variable
  • if / if else condition (run examples/exIfCondition.txt to see example)
  • for and while loop (run examples/exForWhile.txt to see example)
  • function that can be recursive (run examples/exFunction.txt to see example)

About

Yacc and Lex compiler - with variables, if conditions, for & while loop and functions

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors