MSTA(1)

πŸ“¦ version 0.996, in nixos 26.05, nixpkgs unstable

okay bestie, welcome to the MSTA(1) page from User Manuals πŸ’…βœ¨

🌸 NAME 🌸

msta β€” syntax description translator.

✨ SYNOPSIS ✨

Here's the exact command-line lineup, every flag and argument untouched, because we do not mess with command lines:

msta [ -d -define -l -line -t -trace -v -verbose -b file_prefix -p
       sym_prefix -h -help --help -w -c++ -enum -no-enum -pattern-equiv -no-
       pattern-equiv -look-ahead number -la number -lr -no-lr -lalr-
       optimization -no-lalr-optimization -regular-optimization -no-regular-
       optimization -split-lr-sets -no-split-lr-sets -yacc-error-recovery
       -local-error-recovery -minimal-error-recovery -error-reduce -no-error-
       reduce -error-conflict -no-error-conflict -yacc-input -no-yacc-input
       -strict -no-strict -yacc-file-names -no-yacc-file-names -o name -y -yacc
       -full-lr-set -lr-situation-context -removed-lr-sets -expand -no-expand
       -time] specification-file

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so MSTA reads the input grammar β€” like, the grammar described in the specification file β€” and generates a parser for it. Iconic behavior, honestly ✨

It can process any POSIX YACC grammar and generates an equivalent parser in the sence of POSIX standard. (Yep, β€œsence” stays β€” keeping the original spelling, no cap πŸ’€.) But MSTA can do many additional things:

  • generation of more safe error recovery or much better error recovery,
  • better output of generated parser description,
  • generation of fast LALR(k)- and LR(k)-grammar parser with acceptable space requirements,
  • generation of scanners described as context-free grammar (CFG),
  • and so on.

The specification file must have suffix .y πŸŽ€

The generated code consists of optional interface and implementation files and optional description file, having the same names as one of specification file and correspondingly suffixes:

  • .h β€” if option -d or -c++ is given,
  • .c β€” C code,
  • .cpp β€” C++ code,
  • .output β€” description file.

If MSTA runs in YACC regime, the corresponding files will be:

  • y.tab.h β€” if option -d or -c++ is given,
  • y.tab.c β€” C code,
  • y.tab.cpp β€” C++ code,
  • y.output β€” description file.

Full documentation of MSTA is in MSTA User's manual πŸ“–πŸ’–

πŸ’… OPTIONS πŸ’…

okay bestie, here's the whole options buffet β€” and there are a lot of them, so buckle up πŸŽ€

πŸ“ The options which are known for MSTA and YACC are

  • -d β€” create the interface file. by default the interface file is not generated, so if you want it you gotta ask for it πŸ’–
  • -l β€” insert your original code into the generated parser without #line constructs. by default #line constructions are always generated.
  • -t β€” permits compilation of debugging code in the code file (aka tracing of the parser work ✨). runtime debugging statements are always contained in the parser, but by default conditional compilation directives prevent them from being compiled. this option defines the macro YYDEBUG as 1 (by default its value is 0) and as a consequence the debugging statements get processed.
  • -v β€” create a file containing a description of the parser πŸ‘‘
  • -b file_prefix β€” use file_prefix instead of y as the prefix for all output filenames when the YACC regime of generated file names is on.
  • -p sym_prefix β€” use sym_prefix instead of yy as the prefix for all external names (i.e. functions yyparse, yylex, and yyerror, and the variables yylval, yychar, and yydebug) produced by MSTA. so you can rename your whole little family of symbols, slay πŸ’…

πŸ¦‹ Additional options which are known only for MSTA are

  • -define β€” synonym of option -d
  • -line β€” synonym of option -l
  • -trace β€” synonym of option -t
  • -verbose β€” synonym of option -v
  • -h, -help, --help β€” these result in only a brief description of options being output into stderr. the same result can be achieved by calling MSTA without any options and arguments 🫢
  • -w β€” no warning messages at all are generated, e.g. repeated description of type, value, and priority of token or terminal, repeated construction %start, and many others. quiet mode, she's not gonna say a word πŸ™ˆ
  • -c++ β€” output of C++ code instead of C code (which is the default).
  • -enum β€” generate token constants as an enumeration instead of macro.
  • -no-enum β€” generate token constants as macro (this is the default).
  • -pattern-equiv β€” equivalent patterns are denoted by the same nonterminal (this is the default). sometimes this results in dramatic reducing of conflicts when complex patterns are used πŸ”₯
  • -no-pattern-equiv β€” even equivalent patterns are denoted by different nonterminals and are expanded into a different set of rules.
  • -look-ahead number, -la number β€” determine the maximal length of look-ahead when generating an LR(k) and LALR(k) parser. this does not mean MSTA will look ahead that many tokens in each situation and for each input β€” MSTA looks ahead only on the minimal number of tokens required for resolution of a conflict. the default value of maximal look-ahead is 1.
  • -lr β€” input grammar is considered to be a LR(k)-grammar.
  • -no-lr β€” input grammar is considered to be a LALR(k)-grammar. this is the default.
  • -lalr-optimization β€” if the input grammar is considered to be a LR(k)-grammar, MSTA will make LALR(k)-optimization after building the LR(k)-parser. it means MSTA will extract LALR(k)-parts of the LR(k)-grammar and will represent them by adequate LALR-sets. if the input LR(k)-grammar is "almost" a LALR(k)-grammar, MSTA can decrease the size of the generated parser several times over 😭 if the input grammar is a LALR(k)-grammar, MSTA will create a LALR(k)-parser. this option is default when option -lr is given.
  • -no-lalr-optimization β€” when option -lr is given, MSTA does not make LALR-optimization.
  • -regular-optimization β€” after building LALR-sets or LR-sets and optional LALR-optimization, MSTA extracts regular parts of the input grammar and implements them by adequate methods (deterministic finite automaton). this decreases the number of final states in the generated parser and speeds up the parser, but slightly increases the parser size because some actions will be present in several examplars in the parser. the more regular parts in the input grammar, the better this method works ✨ by default this option is on.
  • -no-regular-optimization β€” disable the regular optimizations.
  • -split-lr-sets β€” splitting LR-sets during regular optimization in order to extract the most of regular parts (only when option -regular-optimization is on). by default this option is on if %free_format is present in the specification file.
  • -no-split-lr-sets β€” opposite of the previous one. by default this option is on if %free_format is absent in the specification file.
  • -yacc-error-recovery β€” the generated parser will use error recovery according to the Posix YACC standard. this error recovery is used by default.
  • -local-error-recovery β€” the generated parser will use a slightly modified error recovery method. this method is more safe, and it is guaranteed that this method can not be cycled 🧚
  • -minimal-error-recovery β€” the generated parser will use a minimal cost error recovery, where the cost is the overall number of tokens ignored. it is guaranteed that this method can not be cycled. this method is expensive because it may save many input tokens, parser states, and attributes πŸ’€
  • -error-reduce β€” MSTA generates a parser with possible default reducing (without checking the look-ahead) when the token error is in the context. it means the parser may make a few reduces before recognizing a syntax error. this option is the default.
  • -no-error-reduce β€” the generated parser makes reduces in a situation where shift on error is possible only when there is a corresponding look-ahead. it results in better error recovery, but the parser will have a bigger size.
  • -error-conflict β€” MSTA reports conflicts on look-ahead containing token error in the LR-set which is a result of shifting token error. this option is the default.
  • -no-error-conflict β€” token error is not a real token, it is never read, but many error recovery rules may generate conflicts on error. to avoid this you can use this option. in this case MSTA does report conflicts on look-ahead containing token error in the LR-set which is a result of shifting token error.
  • -yacc-input β€” only Posix YACC input can be used as input grammar.
  • -no-yacc-input β€” all input grammar features of MSTA can be used. this option is the default.
  • -yacc-file-names β€” MSTA output file names are generated according to Posix YACC (y.output, y.tab.c, y.tab.h).
  • -strict β€” use only strict POSIX YACC input (this option is in action only when -yacc-input), not SYSTEM V one. errors are output when nonstrict features are used. these features are usage of ; after definitions and C/C++ code insertions, and usage of a token and a literal in %type clauses as before and after a description of the token and the literal. this option is on by default.
  • -no-strict β€” this option is in action only when -yacc-input is on. only warnings about non-strict POSIX YACC feature usage are output.
  • -no-yacc-file-names β€” output files will have the same name and suffixes (.h, .c, and .output). this option is on by default.
  • -o β€” specify names of output files (header file name.h, code file name.c, description file name.output)
  • -y, -yacc β€” emulate Posix YACC πŸ’– it means the options -yacc-input, -lalr, -yacc-error-recovery, and -yacc-file-names are on, and -c++ is off. this option is useful with other options, e.g. options -lr and -y mean also -yacc-input, -yacc-error-recovery, and -yacc-file-names.
  • -full-lr-set β€” write all LR-situations (besides essential ones) of LR-sets into a file containing a description of the parser (this option acts only with option -v). sometimes it is useful for better understanding conflicts. but in this case the description file can be significantly bigger 😭
  • -lr-situation-context β€” write context of LR-situations into the description of the parser (this option acts only with option -v). sometimes it is useful for better understanding conflicts. but in this case the description file can be huge, especially for LR(k)- and LALR(k)-grammars when k > 1, or when combined with option -full-lr-set, and it affects parser generation speed because the classic method of LR-, LALR-sets is used instead of the fast DeRemer method. by default this option is off.
  • -removed-lr-sets β€” write LR-sets removed during conflict resolution and regular optimization into the description of the parser (this option acts only with option -v). by default such unachievable LR-sets are not present in the description file.
  • -expand β€” attributes and states stacks in the parser will be expandable (this is default).
  • -no-expand β€” attributes and states stacks in the parser will be not expandable.
  • -time β€” output detailed time statistics of MSTA work on its basic passes and optimizations ⏱️

πŸ“ FILES πŸ“

  • file.y β€” MSTA specification file
  • file.c or y.tab.c β€” generated C implementation file
  • file.cpp or y.tab.cpp β€” generated C++ implementation file
  • file.h or y.tab.h β€” generated interface file
  • file.output or y.output β€” generated interface file (that's what the page says, bestie, not me πŸ™ˆ)

There are no any temporary files used by MSTA. squeaky clean ✨


🌱 ENVIRONMENT 🌱

There are no environment variables which affect MSTA behavior. none. zero. she's unbothered πŸ¦‹


🩺 DIAGNOSTICS 🩺

MSTA diagnostics is self-explanatory. she tells you what's wrong, iykyk πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

Vladimir N. Makarov, vmakarov@users.sourceforge.net


πŸ” SEE ALSO πŸ”

oka(1), sprut(1), nona(1), shilka(1). SHILKA manual. go read them all, the whole friend group 🫢


πŸ’€ BUGS πŸ’€

Please, report bugs to cocom-bugs@lists.sourceforge.net. be nice about it, they're doing their best 😭


and that's the whole page, bestie β€” brought to you by COCOM, dated 5 SEP 1999 🌸 no cap, she's been iconic since the 90s. mwah πŸ’‹ ✧ο½₯ οΎŸβ˜† end of page β˜†οΎŸο½₯✧

πŸ“¦ where this page comes from