YACC(1)
π YACC(1) β bestie edition π
okay so real talk: this is a page from the General Commands Manual, and it's about a whole parser generator. yes, the yacc energy. grab a boba, we're doing this π§β¨
πΈ NAME πΈ
Yacc β an LALR(1) parser generator for Java. that's it, that's the whole vibe. iconic. π
β¨ SYNOPSIS β¨
byaccj [ -dlrtvJ ] [ -b prefix ] [-Jclass= classname ] [-Jpackage=
package_name ] [-Jextends= extends_name ] [-Jimplements= implements_name
] [-Jsemantic= semantic_type ] [-Jnorun] [-Jnocontruct] [-Jstack= NNN ]
[-Jnodebug] [-Jfinal] [-Jthrows= exception_list ] filename
π¦ DESCRIPTION π¦
so here's the tea, bestie: Yacc reads the grammar specification sitting in the file filename and generates an LR(1) parser for it. yes, from a grammar. it's giving β¨alchemyβ¨ but make it computer science.
the parsers it spits out are made of two things: a set of LALR(1) parsing tables, plus a driver routine written in the C programming language. (yes babe, C, we love a crossover episode.)
normally Yacc writes the parse tables and the driver routine into the file y.tab.c. main character file name, honestly.
The following options are available:
π OPTIONS π
-b prefixβ this one changes the prefix that gets prepended to the output file names, and it becomes the string you put in prefix. the default prefix is the charactery. so if you want your files to have a different little nickname, this is your moment π-dβ makes the header filey.tab.hget written. cute, we love a header. π-lβ okay so if-lis not specified, yacc will insert The generated code to the user's original code. if the-loption is specified, yacc will not insert the
ngl bestie, the original manpage text right here is genuinely glitched/cut off mid-sentence β I'm not about to make up the rest of it, so you get exactly what the page says. no cap. π
-rβ the-roption causes yacc to produce separate files for code and tables. the code file is namedy.code.c, and the tables file is namedy.tab.c. splitting the besties up, but for a reason. π«Ά-tβ changes the preprocessor directives generated by yacc so that debugging statements will be incorporated in the compiled code. debug baddie era. π₯-vβ causes a human-readable description of the generated parser to be written to the filey.output. it's like a lil diary of your parser, so slay. π-Jβ switches from C/C++ to Java output. not necessary if other-Jflags are used. (it's giving "optional but iconic") β-Jclass=<classname>β changes the name of the Java class (and the.javafile) to classname. name your baby. πΆ-Jpackage=<packagename>β changes the package in which the parser resides, from the default<nothing>to packagename. moving out, getting your own place. π¦-Jextends=<extend_name>β changes the class the parser extends, from the default<nothing>to extend_name. family tree update π³-Jimplements=<implement_name>β changes the interface the parser implements, from the default<nothing>to implement_name. commit to the interface, periodt. π-Jsemantic=<semantic_type>β changes the semantic (value of the rules' variables) type to semantic_type. no extra class will be generated. π§-Jnorunβ informs Byacc to not generate arun()method. useful when working with threads. multitasking queen energy π§΅-Jnoconstructβ informs Byacc to not generate constructors. useful when extending classes. ποΈ-Jstack=<NNN>β changes the stack size from the default500to NNN. go bigger, go smaller, go feral. π-Jnodebugβ informs Byacc to omit debugging code for further better performance. speed demon arc ποΈ-Jfinalβ makes the generated classfinal. no more subclasses, sorry not sorry. π-Jthrows=<exception_list>β informs Byacc to declare thrown exceptions for theyyparse()method. throw it, bestie, throw it. πΎ
if the environment variable TMPDIR is set, the string denoted by TMPDIR will be used as the name of the directory where the temporary files are created. so if your temp files need to live somewhere specific, that's the move. π
π FILES π
the whole friend group:
y.code.cy.tab.cy.tab.hy.output/tmp/yacc.aXXXXXX/tmp/yacc.tXXXXXX/tmp/yacc.uXXXXXX
π DIAGNOSTICS π
if there are rules that are never reduced, the number of such rules is reported on standard error. and if there are any LALR(1) conflicts, the number of conflicts is reported on standard error. so yeah, stderr is where the drama lives β check it, don't ignore it. π
and that's the whole page, bestie π«Ά this lil legend comes to you from the 4.3 Berkeley Distribution, dated July 15, 1990 β yeah, she's vintage, she's a classic, she's still serving. πβ¨ mwah, go build a parser.
π¦ where this page comes from
- debian bookworm: byacc-j 1.15-1.1
- debian trixie: byacc-j 1.15-1.4
- ubuntu jammy: byacc-j 1.15-1build3
- ubuntu noble: byacc-j 1.15-1.2
- ubuntu questing: byacc-j 1.15-1.4
- ubuntu resolute: byacc-j 1.15-2 Β· public_domain
- ubuntu stonking: byacc-j 1.15-2 Β· public_domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms