From af571728d3582b1180408a566e06f5d3cb15e1e9 Mon Sep 17 00:00:00 2001 From: Jacob Higdon <71796549+jahigd02@users.noreply.github.com> Date: Fri, 14 Jul 2023 08:21:15 -0400 Subject: [PATCH] yacc: add page (#10439) Co-authored-by: K.B.Dharun Krishna Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> --- pages/common/yacc.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pages/common/yacc.md diff --git a/pages/common/yacc.md b/pages/common/yacc.md new file mode 100644 index 0000000000..3573db5bf1 --- /dev/null +++ b/pages/common/yacc.md @@ -0,0 +1,17 @@ +# yacc + +> Generate an LALR parser (in C) with a given formal grammar specification file. +> See also: `bison`. +> More information: . + +- Create a file `y.tab.c` containing the C parser code and compile the grammar file with all necessary constant declarations for values. (Constant declarations file `y.tab.h` is created only when the `-d` flag is used): + +`yacc -d {{path/to/grammar_file.y}}` + +- Compile a grammar file containing the description of the parser and a report of conflicts generated by ambiguities in the grammar: + +`yacc -d {{path/to/grammar_file.y}} -v` + +- Compile a grammar file, and prefix output filenames with `prefix` instead of `y`: + +`yacc -d {{path/to/grammar_file.y}} -v -b {{prefix}}`