MSTA(1)
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)- andLR(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-dor-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-dor-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#lineconstructs. by default#lineconstructions 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 macroYYDEBUGas 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 π-bfile_prefix β use file_prefix instead ofyas the prefix for all output filenames when the YACC regime of generated file names is on.-psym_prefix β use sym_prefix instead ofyyas the prefix for all external names (i.e. functionsyyparse,yylex, andyyerror, and the variablesyylval,yychar, andyydebug) 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-aheadnumber,-lanumber β 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-lris given.-no-lalr-optimizationβ when option-lris 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-optimizationis on). by default this option is on if%free_formatis present in the specification file.-no-split-lr-setsβ opposite of the previous one. by default this option is on if%free_formatis 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%typeclauses 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-inputis 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 filename.h, code filename.c, description filename.output)-y,-yaccβ emulate Posix YACC π it means the options-yacc-input,-lalr,-yacc-error-recovery, and-yacc-file-namesare on, and-c++is off. this option is useful with other options, e.g. options-lrand-ymean 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 whenk > 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 filefile.cory.tab.cβ generated C implementation filefile.cppory.tab.cppβ generated C++ implementation filefile.hory.tab.hβ generated interface filefile.outputory.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
- nixos 26.05: cocom 0.996
- nixpkgs unstable: cocom 0.996
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms