Using iyacc and BYACC/J
The name yacc stands for yet-another-compiler-compiler. This category of tools takes a context-free grammar as input and generates a parser from it. Yacc-compatible tools are available for most popular programming languages.
In this book, for Unicon we use iyacc (short for Icon yacc) and for Java you can use BYACC/J (short for Berkeley YACC extended for Java). They are highly compatible with UNIX yacc
and we can present them together as one language for writing parsers. In the rest of this chapter, we will just say yacc
when we mean both iyacc
and BYACC/J
(which is invoked as yacc
, at least on Windows). Complete compatibility required a bit of Kobayashi Maru, mostly when it comes to the semantic actions, which are written in native Unicon and Java respectively.
Yacc files are often called (yacc
) specifications. They use the extension .y
and
consist of several sections, separated by %%
. This book refers generically to yacc
specifications meaning the input...