pyacc(1)

πŸ’– pyacc πŸ’–

okay bestie, welcome to the pyacc page β€” the Pascal parser generator manual, but make it a group chat. sit down, hydrate, and let's get into it. πŸ“


✨ NAME ✨

pyacc β€” Pascal Yacc compiler compiler. compiler compiler, yes, it's giving inception-core and we love that for it. πŸ’…


🌸 USAGE 🌸

yacc [options] yacc-file[.y] [output-file[.pas]]

so you run yacc, you hand it options, you hand it a yacc-file (which lowkey defaults to a .y suffix), and then optionally an output-file (which highkey defaults to a .pas suffix). that's the whole vibe check. ✨

SH OPTIONS

  • -v β€” Verbose mode, bestie. Pascal Yacc generates a readable description of the generated parser and writes it to yacc-file with the new extension .lst. it's giving receipts, but make them legible. πŸ“
  • -d β€” Debug mode. TP Yacc generates a parser with debugging output. yes, the parser will yap, but like, helpfully. πŸ›

πŸ‘‘ DESCRIPTION πŸ‘‘

TP Yacc is the program that lets you prepare parsers from a description of input languages using BNF-like grammars. no cap. you simply specify the grammar for your target language β€” augmented with the Turbo Pascal code necessary to process the syntactic constructs β€” and TP Yacc translates your grammar into the Turbo Pascal code for a corresponding parser subroutine named yyparse. it's literally the glow-up pipeline: grammar in, parser out. πŸ’–

TP Yacc parses the source grammar contained in yacc-file (with default suffix .y) and writes the constructed parser subroutine to the specified output-file (with default suffix .pas). if no output file is specified, output goes to yacc-file with the new suffix .pas. and if any errors are found during compilation, error messages are written to the list file (yacc-file with the new suffix .lst). 🫢

The generated parser routine, yyparse, is declared as:

function yyparse : Integer;

This routine may be called by your main program to execute the parser. the return value of the yyparse routine denotes success or failure of the parser β€” and here are the possible return values, memorise them bestie, this is the important part: 0 = success, 1 = unrecoverable syntax error or parse stack overflow. 😭

Similar to TP Lex, the code template for the yyparse routine may be found in the yyparse.cod file. The rules for locating this file are analogous to those of TP Lex (see Section TP Lex). so if you know how TP Lex does it, you already know. iykyk. 🧚

The TP Yacc library (YaccLib) unit is required by programs using Yacc-generated parsers; you will therefore have to put an appropriate uses clause into your program or unit that contains the parser routine. don't skip this, it's not optional, the parser will simply not slay without it. The YaccLib unit also provides some routines which may be used to control the actions of the parser. See the file yacclib.pas for further information. πŸ‘‘


More information πŸ’¬

For more information, see the documentation that comes with TP lex and yacc. that's the plug, go read the docs. πŸ“š


🌈 AUTHOR 🌈

Albert Graeff (<ag@muwiinfa.geschichte.uni-mainz.de>, <Dr.Graef@t-online.de>). icon, legend, the moment. πŸ‘‘


⭐ SEE ALSO ⭐


okay that's the whole page, you ate it, periodt. πŸŽ€ this was Free Pascal, dated 19 Jan 2000, and the manual page is pyacc(1) β€” and yes it's still iconic, mwah. πŸ’œπŸ¦‹

πŸ“¦ where this page comes from