next up previous
Next: The XASM Support Environment Up: XASM- An Extensible, Component-Based Previous: The ``Once''-Rule


Grammar Definitions in XASM

Historically, XASM has been developed as underlying ASM implementation for Montages, a semi-visual method for specifying the syntax and semantics of programming languages, see [19,1,2]. As a consequence, the support for programming language related features has been integrated into the XASM language as a means to extend the original syntax with domain-specific constructs. The syntax and semantics of these extensions can be specified using the Montages method together with tool support environment Gem-Mex which translates user-defined language definitions into XASM-code.

The grammar definitions used for the translation of Montages-specification can also be used directly in XASM. For that purpose, nonterm and token-declarations can be given in XASM, resulting in the generation of a parser for the specified language. As an example for using grammar definitions in XASM, Figure 5 contains the specification of a parser that accepts empty XML tags. The generated C-function can be accessed using an external function returning the root node of the parse tree being constructed during parsing.


Figure 5: A grammar specification in XASM for parsing empty XML Elements
\begin{figure}\noindent
\begin{asmfbox}
\ASM xmlparser(inpfile) \IS
\USE syntax...
...\par RootNode := parse\_Elements(inpfile);
\par\ENDASM
\end{asmfbox}\end{figure}


next up previous
Next: The XASM Support Environment Up: XASM- An Extensible, Component-Based Previous: The ``Once''-Rule
Philipp Kutter 2002-03-18