Xreate
The Xreate programming language
Public Member Functions | List of all members
AST Class Reference

AST in a consistent state. More...

#include <ast.h>

Detailed Description

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).

See also
xreate::details::inconsistent::AST
Inheritance diagram for AST:
AST

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< FunctionfindFunction (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::ASTfinalize ()
 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
 

Member Function Documentation

◆ expandType()

Expanded< TypeAnnotation > expandType ( const TypeAnnotation t) const

Computes fully expanded form of type by substituting all arguments and aliases.

Parameters
tType to expand
Returns
Expdanded or normal form of type
See also
TypeAnnotation

◆ findType()

Expanded< TypeAnnotation > findType ( const std::string &  name)

Searches type by given name

Parameters
nameTypename to search
Returns
Expanded or normal form of desired type
Note
if type name is not found returns new undefined type with this name

◆ getType()

ExpandedType getType ( const Expression expression)

Invokes Type Inference Analysis to find out expanded(normal) form expressions's type

See also
typeinference.h
Parameters
expression
Returns
Type of expression

The documentation for this class was generated from the following files: