DynGenPar
Dynamic Generalized Parser
List of all members
DynGenPar::Pmcfg Struct Reference

PMCFG. More...

Public Attributes

grammar
QList< Functionfunctions
 list of PMCFG functions More...
 
RuleSet rules
 set of PMCFG rules More...
 
TokenSet tokens
 set of true tokens More...
 
Cat startCat
 start category More...
 
RuleSet cfRules
 optional context-free rules More...
 

function name tables (optional)

QHash< int, QString > functionNames
 
QHash< QString, int > functionIndices
 
void addFunction (const QString &name, const Function &function)
 
Function lookupFunction (const QVariant &id) const
 

Detailed Description

PMCFG.

Definition at line 1047 of file dyngenpar.h.

Member Function Documentation

◆ addFunction()

void DynGenPar::Pmcfg::addFunction ( const QString &  name,
const Function function 
)
inline

Definition at line 1095 of file dyngenpar.h.

◆ lookupFunction()

Function DynGenPar::Pmcfg::lookupFunction ( const QVariant &  id) const
inline

Definition at line 1101 of file dyngenpar.h.

Member Data Documentation

◆ cfRules

RuleSet DynGenPar::Pmcfg::cfRules

optional context-free rules

allows specifying rules for context-free categories which can be used as "token" terms in PMCFG functions, e.g. A -> "a" | "an"

Warning
The exact expansion used will be reflected only in the parse tree, not in the PMCFG syntax tree. Do not use this feature if you need to know which exact expression was used.

Definition at line 1088 of file dyngenpar.h.

◆ functionIndices

QHash<QString, int> DynGenPar::Pmcfg::functionIndices

Definition at line 1094 of file dyngenpar.h.

◆ functionNames

QHash<int, QString> DynGenPar::Pmcfg::functionNames

Definition at line 1093 of file dyngenpar.h.

◆ functions

QList<Function> DynGenPar::Pmcfg::functions

list of PMCFG functions

This list does not store function names. They can be optionally used and are stored in functionNames and functionIndices.

Definition at line 1054 of file dyngenpar.h.

◆ rules

RuleSet DynGenPar::Pmcfg::rules

set of PMCFG rules

Rules should be labeled with the index of the function in functions or its name as found in functionNames and functionIndices. The expression of the rule is interpreted as the argument list for the function. For example:

Rule(1) << "A" << "B"; // calls function #1 with (A, B) as parameters
Rule("f") << "A" << "B"; // calls f(A, B)

In a standard PMCFG, the argument list may contain only PMCFG nonterminals. The syntax tree then only contains the function and the syntax trees for each argument. This implementation also allows tokens and context-free nonterminals as function arguments, in which case the syntax tree will contain the parse tree for the context-free argument. In particular, in the case of a token, the data attached to the token is retained.

Definition at line 1073 of file dyngenpar.h.

◆ startCat

Cat DynGenPar::Pmcfg::startCat

start category

The start category must be 1-dimensional.

Definition at line 1079 of file dyngenpar.h.

◆ tokens

TokenSet DynGenPar::Pmcfg::tokens

set of true tokens

(must NOT contain context-free nonterminals)

Definition at line 1076 of file dyngenpar.h.


The documentation for this struct was generated from the following file: