Xreate
The Xreate programming language
|
AST in a consistent state. More...
#include <ast.h>
AST in a consistent state.
AST has two mutually exclusive possible states:
This class represents a consistent state and should be used by clients unless client's code explicitly works with AST under construction. Consistent AST enables access to additional functions(such as type management).
Public Member Functions | |
ExpandedType | expandType (const TypeAnnotation &t) const |
Computes fully expanded form of type by substituting all arguments and aliases. More... | |
ExpandedType | findType (const std::string &name) |
ExpandedType | getType (const Expression &expression) |
Public Member Functions inherited from AST | |
void | add (Function *f) |
Adds new function to AST. More... | |
void | add (MetaRuleAbstract *r) |
Adds new declarative rule to AST. More... | |
ManagedScpPtr | add (CodeScope *scope) |
Registers new code block. | |
void | add (TypeAnnotation t, Atom< Identifier_t > alias) |
Add new type to AST. More... | |
std::string | getModuleName () |
Current module's name. | |
ManagedPtr< Function > | findFunction (const std::string &name) |
Looks for function with given name. More... | |
std::list< ManagedFnPtr > | getAllFunctions () const |
Returns all function in AST. | |
std::list< ManagedFnPtr > | getFunctionSpecializations (const std::string &fnName) const |
Returns all specializations of a function with a given name. More... | |
template<class Target > | |
ManagedPtr< Target > | begin () |
xreate::AST * | finalize () |
Performs all necessary steps after AST is built. More... | |
void | addDFAData (Expression &&data) |
Stores DFA scheme for later use by DFA Pass. More... | |
void | addExternData (ExternData &&data) |
Stores data for later use by xreate::ExternLayer. | |
void | addInterfaceData (const ASTInterface &interface, Expression &&data) |
Generalized function to store particular data for later use by particular pass. More... | |
void | recognizeVariantConstructor (Expression &function) |
Tries to find out whether expression is Variant constructor. | |
Atom< Number_t > | recognizeVariantConstructor (Atom< Identifier_t > ident) |
void | postponeIdentifier (CodeScope *scope, const Expression &id) |
Postpones unrecognized identifier for future second round of recognition. More... | |
void | recognizePostponedIdentifiers () |
Second round of identifiers recognition done right after AST is fully constructed. | |
Additional Inherited Members | |
Public Attributes inherited from AST | |
std::set< std::pair< CodeScope *, Expression > > | bucketUnrecognizedIdentifiers |
Expanded< TypeAnnotation > expandType | ( | const TypeAnnotation & | t | ) | const |
Computes fully expanded form of type by substituting all arguments and aliases.
t | Type to expand |
Expanded< TypeAnnotation > findType | ( | const std::string & | name | ) |
Searches type by given name
name | Typename to search |
ExpandedType getType | ( | const Expression & | expression | ) |
Invokes Type Inference Analysis to find out expanded(normal) form expressions's type
expression |