[ Home | Main Table Of Contents | Table Of Contents | Keyword Index ]

marpatcl_marpagen(n) 0.2 doc "Marpa/Tcl, a binding to libmarpa"

Name

marpatcl_marpagen - Marpa/Tcl - The Generator Application

Table Of Contents

Synopsis

Description

Welcome to Marpa/Tcl, a Tcl binding to the "libmarpa" parsing engine.

Please read the document Marpa/Tcl - Introduction to Marpa/Tcl, if you have not done so already. It provides an overview of the whole system.

Audience

This document is targeted at users of Marpa/Tcl with the goal of creating parser packages.

marpa-gen

marpa-gen is the generator application used to read a SLIF grammar definition and create various forms of output, including packages implementing parsers and lexers for the grammar.

To make effective use of it is recommended to also read Marpa/Tcl - The SLIF grammar specification language.

marpa-gen ?options...? ?--? grammar-file ?output?

In its most basic form the generator command is invoked with the path to a grammar-file, printing the result to stdout. If a second path to output is specified the result is saved into that file, possibly creating it.

Invoking the command with no arguments, while technically invalid, causes it to print basic help information, i.e. syntax, available options, and available output types.

The available options are:

-author string
-A string

Specifies the name of the author to embed in the output, provided that is supported by the chosen type. Defaults to the name of the user invoking the generator.

-name string
-N string

Specifies the name of the result to embed in the output, provided that is supported by the chosen type. Defaults to the empty string.

-type string
-T string

Specifies the type of output to generate. If not specified defaults to tparse. The currently available output types are

clex-critcl

Generate a lexer written in C and embedded into Tcl via critcl. The grammar is rewritten to handle charactres beyond the unicode BMP via CESU-8, i.e. UTF-8 encoded pairs of surrogate characters, to match Tcl. The structural rules of the input grammar are ignored. See also tlex.

cparse-critcl

Generate a parser written in C and embedded into Tcl via critcl. The grammar is rewritten to handle charactres beyond the unicode BMP via CESU-8, i.e. UTF-8 encoded pairs of surrogate characters, to match Tcl.

cparse-raw

Generate a parser written in C, without any embedding. The grammar is rewritten to handle the unicode SMP via normal UTF-8 encoding, i.e. as sequences of 4 bytes.

gc

Generates Tcl code which initializes a marpa::slif::container with the serialization of the input grammar.

gc-c

As gc above, with the grammar rewritten like is done for cparse-critcl, and clex-critcl.

gc-compact

As gc above, with all superfluous whitespace removed.

gc-tcl

As gc above, with the grammar rewritten like is done for tparse and tlex.

slif

Generate a SLIF grammar. Defaults from the input are resolved. Rules are sorted, and reformatted (pretty printed).

tlex

Generate a lexer written in Tcl. The structural rules of the input grammar are ignored. See also clex-critcl.

tparse

Generate a parser written in Tcl.

-version string
-V string

Specifies the version to number embed in the output, provided that is supported by the chosen type. Defaults to 1.

--

This option ends option processing, even if arguments coming after it start with dash (-).

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such at the Marpa/Tcl Tracker. Please report any ideas for enhancements you may have for either package and/or documentation as well.

Keywords

aycock, character classes, context free grammar, document processing, earley, horspool, joop leo, lexing, libmarpa, nigel horspool, parsing, regex, table parsing