Module rustlr::generic_absyn[][src]

Expand description

Generic Abstract Syntax Support Module

Rustlr allows any type that implements the Default trait to be used as the abstract syntax type (grammar directive absyntype). However, this module defines a generic abstract syntax type GenAbsyn, along with custom smart pointer LBox (and alias ABox), that simplifies the construction of abstract syntax trees. LBox keeps the line and column numbers of each syntatic construct.

Structs

Structure for configuring specific use of GenAbsyn type, which provides generic representations of binary, unary, ternary and vectorized operators. GenAbsyn also distinguishes keywords from other alphanumeric and non-alphanumeric symbols. Since these are provided from source code, &’static str is used instead of owned strings. The index of the corresponding &’static str in the static array OPERATORS will determine the usize index that identifies each Binop, Uniop, etc.

custom smart pointer that encapsulates line number, column and other information for warnings and error messages after the parsing stage. Implements Deref and DerefMut so the encapsulated expression can be accessed as in a standard Box. For example, an abstract syntax type can be defined by

Enums

Generic Abstract Syntax type: Rustlr offers the user the option of using a ready-made abstract syntax type that should be suitable for ordinary situations. Incorporates the usage of LBox so that abstract syntax trees always carry line/column information for error reporting and warnings. Rustlr will implement an option to produce a parser that uses GenAbsyn in conjunction with ABox, and a custom parse_generic function that should simplify the process of parsing into abstract syntax.

Type Definitions

LBox specific to GenAbsyn type, implements Debug and Clone, unlike a generic LBox