A parser for the Bond scripting language.
More...
#include <bond/compiler/parser.h>
A parser for the Bond scripting language.
The Parser parses the contents of a TokenCollection generated from a Lexer that has scanned Bond source code. Its output is a parse tree of objects that derive from ParseNode. The concrete type of the root node is TranslationUnit. The parse tree can then be used as input to a SemanticAnalyzer and CodeGenerator. A single Parser can be used to parse several collections of Tokens.
When writing a tool that requires a compiler front end, the interactions between the front end components, namely a Lexer, a Parser and a SemanticAnalyzer, can be managed by a FrontEnd.
- See also
- CompilerErrorBuffer, FrontEnd, Lexer, SemanticAnalyzer, TokenCollection, TokenStream, TranslationUnit
◆ Parser() [1/2]
Constructs a Parser object.
- Parameters
-
| allocator | The memory allocator from which ParseNodes are allocated. |
| errorBuffer | Buffer where error messages are pushed when syntax errors are encountered. |
| store | Store of owning pointers to the ParseNodes created by this Parser. The ParseNodes are destroyed when the store is destroyed. They reference the Tokens from which they were parsed, so the TokenCollections must outlive the store. |
◆ Parser() [2/2]
| Bond::Parser::Parser |
( |
const Parser & | other | ) |
|
|
delete |
◆ GetErrorBuffer()
Returns the buffer where error messages are pushed.
◆ GetParseNodeStore()
Returns the store of owning pointers to the ParseNodes created by this Parser.
◆ operator=()
◆ Parse() [1/2]
Parses a sequence of Tokens and generates a parse tree.
- Parameters
-
| collection | The collection of Tokens to be parsed. |
- Returns
- A parse tree of ParseNodes rooted with a TranslationUnit.
◆ Parse() [2/2]
Parses a sequence of Tokens and generates a parse tree.
- Parameters
-
| stream | The stream of Tokens to be parsed. |
- Returns
- A parse tree of ParseNodes rooted with a TranslationUnit.
The documentation for this class was generated from the following file:
- include/bond/compiler/parser.h