Skip to content

VenkateshBH99/Interpreter-for-Prefix-Expression-Evaluation--using-lex-and-yaac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interpreter-for-Prefix-Expression-Evaluation-using-lex-and-yaac

This is an implementation of a simple interpreter using lex and yaac for evaluating a given cfg

Building the interpreter

yacc -y -d yacc_compile.y

lex yacc_compile.l

gcc -c y.tab.c lex.yy.c

gcc lex.yy.o y.tab.o yacc_compile.c -o compile

./compile

  1. example:[ ; [ = x 5 ] [ ; if [ < x 3 ] [ = x [ + x 2 ] ] [ = x [ * x 2 ] ] ] [ return x ] ]

     ans: 10
    
  2. example: [ * [ + 1 3 ] [ + 2 3 ] ]

    ans: 20
    

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published