Reference

sglr(1)

the Scannerless Generalized LR parser

NAME

SGLR - the Scannerless Generalized LR parser

SYNOPSIS

sglr -p file [-2?AbcdhlmnstvV] [-f[adeirp]] [-i file] [-o file] [-s sort]

DESCRIPTION

The sglr parser uses a specified parse table to parse an input file. After a successful parse, the resulting parse forest is written to an output file.

A number of options can be supplied; these are as follows:

-2

Generate AsFix2 output format.

-A

Ambiguities are treated as errors.

-b, -t

Choose between binary (b) and plaintext (t) output formats. Default is binary output.

-c

Toggles cycle detection (on by default).

-d

Toggles debug mode. In debug mode, a full trace for the entire parse is maintained in the .sglr-log. Be alert: such files tend to become rather big.

-f

The parser applies a number of filters to ambiguous trees after the parsing process has finished. Just supplying the -f option toggles the application of all filters. Specific filters can be toggled by using -f with an additional letter:

 a : associativity        
 d : direct eagerness    
 e : eagerness          
 i : injection count   
 p : priority         
 r : reject          

 e.g., "sglr -fi" will toggle the injection count filter.

These specific toggles are supposed to be used for debugging purposes only. So, do not use these options to tweak your language implementations! It is highly probable that there will be no backward compatibility for them in future versions.

-i file

Read input from file; by default, input is read from stdin.

-?, -h

Prints concise usage information (reflecting current setup).

-l

Toggles statistics mode (off by default). Produces some run-time statistics in sglr-stats.txt, including time and - on platforms on which these can be obtained - memory usage data.

-m

Generate AsFix2ME output format. This is the default format.

-n

Toggles the contruction of the parse tree (on by default).

-o file

Write output to file; by default, output is written to stdout. Note that strange things are bound to happen when writing binary output to a tty.

-s sort

Only parse trees that have sort at their root are accepted.

-v

Toggles verbose operation.

-V

Displays the program's version number.

USAGE

To parse, the sglr parser requires a parse table. Instantiated with that parse table, it has become a parser for the language defined by the grammar corresponding to the specified parse table.

EXAMPLES

    $ sglr -h
    Usage:
      sglr    -p file [-2?AbcdhlmntvV] [-f[adeirp]] [-i file] [-o file] \
              [-s sort]
    [. . .]
    $ sglr -vp Test.tbl -i MyCode.cod -o Output.File -l
    sglr: logging to sglr-stats.txt
    sglr: opening parse table Test.tbl
    sglr: parsing file MyCode.cod (1 tokens)
    sglr: writing parse result to Output.File
    sglr: Test.tbl parsed MyCode.cod as sort S, exactly 0 ambiguities

EXIT STATUS

Returns an error on unsuccesful parses.

SEE ALSO

the sdf2table manpage

REFERENCES

GraphViz: <http://www.research.att.com/sw/tools/graphviz/>

NOTES

In a different context altogether, sglr runs as a ToolBus client.

MAINTAINER

Mark van den Brand <[email protected]>