May 2015
Intermediate to advanced
296 pages
5h 10m
English
Now that a full-fledged lexer and parser for our TOY language grammar are defined, it's time to run it on example TOY language.
To do this, you should have understanding of TOY language grammar and all the previous recipes of this chapter.
Run and test the Lexer and Parser on TOY Language, as shown in the following:
toy.cpp program into an executable:$ clang++ toy.cpp -O3 -o toy
toy executable is our TOY compiler frontend. The toy language to be parsed is in a file called example:$ cat example def foo(x , y) x + y * 16
toy compiler:$ ./toy example
The TOY compiler will open the
Read now
Unlock full access