-
Notifications
You must be signed in to change notification settings - Fork 2
AFParser Creation
This section introduces the concept of the AFParser Data Structure, which is a representation of the AFG we want to accept the language of, and how the data structure is created.
The AFParser Data Structure consists of BaseParser objects, where each BaseParser object maintains a std::vector of BaseParser pointers pointing to other BaseParser objects in the data structure. Each BaseParser object has a tag_
member data which indicates a more specific type. The possible tag_
values and what they indicate about the BaseParser object are as follows:
- DEF – Formal definition of a nonterminal
- NON – Instance of a nonterminal; maintains information about flow variables
- TOK – Formal definition or instance of a terminal; can maintain information about flow variables
- SEQ – Sequence
- ALT – Alternation
- ACT – Semantic Action
We often refer to BaseParser objects in the AFParser Data Structure as nodes. Thus, a BaseParser object with its tag_
set to DEF is a “DEF node”, a BaseParser object with its tag_
set to NON as a “NON node”, and so on. Each of these different types of nodes play a different role when parsing input.