A ParserDriver that can parse P4-14 programs. More...

Static Public Member Functions | |
| static const IR::V1Program * | parse (FILE *in, const char *sourceFile, unsigned sourceLine=1) |
| static const IR::V1Program * | parse (std::istream &in, const char *sourceFile, unsigned sourceLine=1) |
Protected Member Functions | |
| void | addPragma (IR::Annotation *pragma) |
| Add @pragma to the list of active pragmas. | |
| void | clearPragmas () |
| Clear the list of active pragmas. | |
| IR::Constant * | constantFold (IR::Expression *expr) |
| IR::Vector< IR::Expression > | makeExpressionList (const IR::NameList *list) |
| const IR::Annotations * | takePragmasAsAnnotations () |
| IR::Vector< IR::Annotation > | takePragmasAsVector () |
Protected Member Functions inherited from P4::AbstractParserDriver | |
| void | onParseError (const Util::SourceInfo &location, const std::string &message) |
| void | onReadComment (const char *text, bool lineComment) |
| void | onReadFileName (const char *text) |
| Notify that the lexer read a filename from a #line directive. | |
| void | onReadIdentifier (cstring id) |
| Notify that the lexer read an identifier, @id. | |
| void | onReadLineNumber (const char *text) |
| Notify that the lexer read a line number from a #line directive. | |
| void | onReadToken (const char *text) |
| Notify that the lexer read a token. @text is the matched source text. | |
Protected Attributes | |
| IR::V1Program * | global = nullptr |
| The root of the IR tree we're constructing. | |
Protected Attributes inherited from P4::AbstractParserDriver | |
| int | saveState = -1 |
| Scratch storage for the lexer to remember its previous state. | |
| Util::InputSources * | sources |
| The input sources that comprise the P4 program we're parsing. | |
| Util::SourceInfo | yylloc |
| The location of the most recent token. | |
Friends | |
| class | V1::V1Lexer |
| class | V1::V1Parser |
A ParserDriver that can parse P4-14 programs.
|
protected |
The P4-14 parser performs constant folding to ensure that constant expressions in the grammar actually produce IR::Constant values in the resulting IR.
|
protected |
|
static |
Parse a P4-14 program.
| in | The input source to read the program from. |
| sourceFile | The logical source filename. This doesn't have to be a real filename, though it normally will be. This is used for logging and to set the initial source location. |
| sourceLine | The logical source line number. For programs parsed from a file, this will normally be 1. This is used to set the initial source location. |
|
protected |
|
protected |