#include <AST.hxx>
Public Member Functions | |
| bool | isGlobal () |
| bool | isFnxn () |
| size_t | nBits () |
| bool | isLiteral () |
| bool | isTopLevelForm () |
| bool | isIdentType (IdentType idt) |
| bool | leadsToTopLevelForm () |
| void | clearTypes () |
| void | disown (size_t s) |
| The only place this is called is in the parser, and there only to strip documentation strings. That is actually a bad thing to do, since we want to preserve them in the AST, and a literal value really ought to be a perfectly legal (if useless) expression. We should attempt to comment out the body of stripDocString() and see if everything still works. If so, both this and stripDocString() should be removed. | |
| std::string | atKwd () const |
| void | getIds (std::ostream &errStream, std::vector< boost::shared_ptr< AST > > &ids, bool getPattern=false) |
| Append all ident ASTs from a Binding-pattern to the ids vector. | |
| boost::shared_ptr< Type > | getType () |
| Utility function to call symType->getType(). | |
| boost::shared_ptr< const Type > | getType () const |
| Utility function to call symType->getType(). | |
| boost::shared_ptr< AST > | getCtr () |
| boost::shared_ptr< AST > | Use () |
| Given a defining occurrence, return a new AST for a use occurrence. | |
| AST (boost::shared_ptr< AST > ast, bool shallowCopyChildren=true) | |
| Copy constructor -- make an exact (except ID) shallow copy. | |
| boost::shared_ptr< AST > | getTrueCopy () |
| Make an exact copy, deep, including symbolDef, type, etc. | |
| boost::shared_ptr< AST > | getDeepCopy () |
| Make an exact deep copy. | |
| void | rename (boost::shared_ptr< AST > from, std::string newName) |
| std::string | asString () const |
| Return pretty-printed representation of this AST in the form of a string. | |
| boost::shared_ptr< AST > | getID () |
| Get the unique identifier for this AST. | |
| boost::shared_ptr< AST > | getInstanceMethod (std::string name) |
| From a definstance AST, get the definition corresponding to the method `name'. | |
| bool | isUnionLeg () |
| Return true IFF this is a AST corresponds to a union leg. | |
| bool | isTcMethod () |
| Return true IFF this AST is a type class method name identifier. | |
| int | precedence () const |
| void | PrettyPrint (std::ostream &out, bool showTypes=false, bool endline=true) const |
Pretty print this AST to out, annotating each with its type if showTypes is true, and appending a final end of line of endline is true. | |
| void | PrettyPrint (bool decorated) const |
| top-level wrapper for the pretty printer | |
| AST (const AstType at=at_Null) | |
| AST (const AstType at, const AST_TOKEN_TYPE &tok) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1, AST_SMART_PTR< AST > child2) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1, AST_SMART_PTR< AST > child2, AST_SMART_PTR< AST > child3) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1, AST_SMART_PTR< AST > child2, AST_SMART_PTR< AST > child3, AST_SMART_PTR< AST > child4) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1, AST_SMART_PTR< AST > child2, AST_SMART_PTR< AST > child3, AST_SMART_PTR< AST > child4, AST_SMART_PTR< AST > child5) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1, AST_SMART_PTR< AST > child2, AST_SMART_PTR< AST > child3, AST_SMART_PTR< AST > child4, AST_SMART_PTR< AST > child5, AST_SMART_PTR< AST > child6) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1, AST_SMART_PTR< AST > child2, AST_SMART_PTR< AST > child3, AST_SMART_PTR< AST > child4, AST_SMART_PTR< AST > child5, AST_SMART_PTR< AST > child6, AST_SMART_PTR< AST > child7) | |
| AST (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1, AST_SMART_PTR< AST > child2, AST_SMART_PTR< AST > child3, AST_SMART_PTR< AST > child4, AST_SMART_PTR< AST > child5, AST_SMART_PTR< AST > child6, AST_SMART_PTR< AST > child7, AST_SMART_PTR< AST > child8) | |
| ~AST () | |
| const AST_SMART_PTR< AST > | child (size_t i) const |
| AST_SMART_PTR< AST > & | child (size_t i) |
| void | addChild (AST_SMART_PTR< AST > cld) |
| ::std::string | getTokenString () |
| void | addChildrenFrom (AST_SMART_PTR< AST > other) |
| const char * | astTypeName () const |
| const char * | astName () const |
| bool | isMemberOfType (AstType) const |
| bool | isValid () const |
Static Public Member Functions | |
| static boost::shared_ptr< AST > | makeBoolLit (const sherpa::LToken &tok) |
| static boost::shared_ptr< AST > | makeIntLit (const sherpa::LToken &tok) |
| static boost::shared_ptr< AST > | makeStringLit (const sherpa::LToken &tok) |
| static boost::shared_ptr< AST > | makeCharLit (const sherpa::LToken &tok) |
| static boost::shared_ptr< AST > | makeFloatLit (const sherpa::LToken &tok) |
| static boost::shared_ptr< AST > | genIdent (const char *pfx="tmp", const bool isTV=false) |
| static boost::shared_ptr< AST > | genSym (boost::shared_ptr< AST > lhs, const char *pfx="tmp", const bool isTV=false) |
| static boost::shared_ptr< AST > | make (boost::shared_ptr< AST > ast, bool shallowCopyChildren=true) |
| static AST_SMART_PTR< AST > | make (const AstType at=at_Null) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_TOKEN_TYPE &tok) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc, AST_SMART_PTR< AST > child1) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc, const AST_SMART_PTR< AST > child1, const AST_SMART_PTR< AST > child2) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc, const AST_SMART_PTR< AST > child1, const AST_SMART_PTR< AST > child2, const AST_SMART_PTR< AST > child3) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc, const AST_SMART_PTR< AST > child1, const AST_SMART_PTR< AST > child2, const AST_SMART_PTR< AST > child3, const AST_SMART_PTR< AST > child4) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc, const AST_SMART_PTR< AST > child1, const AST_SMART_PTR< AST > child2, const AST_SMART_PTR< AST > child3, const AST_SMART_PTR< AST > child4, const AST_SMART_PTR< AST > child5) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc, const AST_SMART_PTR< AST > child1, const AST_SMART_PTR< AST > child2, const AST_SMART_PTR< AST > child3, const AST_SMART_PTR< AST > child4, const AST_SMART_PTR< AST > child5, const AST_SMART_PTR< AST > child6) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc, const AST_SMART_PTR< AST > child1, const AST_SMART_PTR< AST > child2, const AST_SMART_PTR< AST > child3, const AST_SMART_PTR< AST > child4, const AST_SMART_PTR< AST > child5, const AST_SMART_PTR< AST > child6, const AST_SMART_PTR< AST > child7) |
| static AST_SMART_PTR< AST > | make (const AstType at, const AST_LOCATION_TYPE &loc, const AST_SMART_PTR< AST > child1, const AST_SMART_PTR< AST > child2, const AST_SMART_PTR< AST > child3, const AST_SMART_PTR< AST > child4, const AST_SMART_PTR< AST > child5, const AST_SMART_PTR< AST > child6, const AST_SMART_PTR< AST > child7, const AST_SMART_PTR< AST > child8) |
| static const char * | tagName (const AstType at) |
Data Fields | |
| AstType | astType |
| ::std::string | s |
| AST_LOCATION_TYPE | loc |
| ::std::vector< AST_SMART_PTR< AST > > | children |
| unsigned long long | ID |
| LitValue | litValue |
| unsigned long | litBase |
| IdentType | identType |
| AstFlags | flags |
| PrintFlags | printVariant |
| boost::shared_ptr< TypeScheme > | scheme |
| boost::shared_ptr< Type > | symType |
| boost::shared_ptr< AST > | symbolDef |
| bool | isDecl |
| boost::shared_ptr< AST > | defn |
| boost::shared_ptr< AST > | decl |
| FQName | fqn |
| std::string | externalName |
| EnvSet | envs |
| boost::shared_ptr< AST > | defForm |
| Pointer to defining form. | |
| boost::shared_ptr< AST > | defbps |
| boost::shared_ptr< Type > | tagType |
| If this is a union, tagType is the type of the tag. | |
| size_t | field_bits |
| size_t | unin_discm |
| size_t | total_fill |
| boost::shared_ptr< TypeScheme > | stSigma |
| boost::shared_ptr< AST > | stCtr |
| boost::shared_ptr< AST > | tvarLB |
| boost::shared_ptr< AST > | parentLB |
Definition at line 738 of file AST.hxx.
| AST::AST | ( | boost::shared_ptr< AST > | ast, | |
| bool | shallowCopyChildren = true | |||
| ) |
| AST::AST | ( | const AstType | at = at_Null |
) |
Definition at line 58 of file AST.cxx.
References astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_TOKEN_TYPE & | tok | |||
| ) |
Definition at line 82 of file AST.cxx.
References astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, s, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc | |||
| ) |
Definition at line 108 of file AST.cxx.
References astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
Definition at line 133 of file AST.cxx.
References addChild(), astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| AST_SMART_PTR< AST > | child1, | |||
| AST_SMART_PTR< AST > | child2 | |||
| ) |
Definition at line 160 of file AST.cxx.
References addChild(), astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| AST_SMART_PTR< AST > | child1, | |||
| AST_SMART_PTR< AST > | child2, | |||
| AST_SMART_PTR< AST > | child3 | |||
| ) |
Definition at line 189 of file AST.cxx.
References addChild(), astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| AST_SMART_PTR< AST > | child1, | |||
| AST_SMART_PTR< AST > | child2, | |||
| AST_SMART_PTR< AST > | child3, | |||
| AST_SMART_PTR< AST > | child4 | |||
| ) |
Definition at line 220 of file AST.cxx.
References addChild(), astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| AST_SMART_PTR< AST > | child1, | |||
| AST_SMART_PTR< AST > | child2, | |||
| AST_SMART_PTR< AST > | child3, | |||
| AST_SMART_PTR< AST > | child4, | |||
| AST_SMART_PTR< AST > | child5 | |||
| ) |
Definition at line 253 of file AST.cxx.
References addChild(), astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| AST_SMART_PTR< AST > | child1, | |||
| AST_SMART_PTR< AST > | child2, | |||
| AST_SMART_PTR< AST > | child3, | |||
| AST_SMART_PTR< AST > | child4, | |||
| AST_SMART_PTR< AST > | child5, | |||
| AST_SMART_PTR< AST > | child6 | |||
| ) |
Definition at line 288 of file AST.cxx.
References addChild(), astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| AST_SMART_PTR< AST > | child1, | |||
| AST_SMART_PTR< AST > | child2, | |||
| AST_SMART_PTR< AST > | child3, | |||
| AST_SMART_PTR< AST > | child4, | |||
| AST_SMART_PTR< AST > | child5, | |||
| AST_SMART_PTR< AST > | child6, | |||
| AST_SMART_PTR< AST > | child7 | |||
| ) |
Definition at line 325 of file AST.cxx.
References addChild(), astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| AST::AST | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| AST_SMART_PTR< AST > | child1, | |||
| AST_SMART_PTR< AST > | child2, | |||
| AST_SMART_PTR< AST > | child3, | |||
| AST_SMART_PTR< AST > | child4, | |||
| AST_SMART_PTR< AST > | child5, | |||
| AST_SMART_PTR< AST > | child6, | |||
| AST_SMART_PTR< AST > | child7, | |||
| AST_SMART_PTR< AST > | child8 | |||
| ) |
Definition at line 364 of file AST.cxx.
References addChild(), astType, decl, defbps, defForm, defn, field_bits, flags, boost::GC_NULL, ID, id_unresolved, identType, isDecl, loc, NO_FLAGS, parentLB, pf_NONE, printVariant, scheme, symbolDef, symType, tagType, total_fill, tvarLB, and unin_discm.
| void AST::addChild | ( | AST_SMART_PTR< AST > | cld | ) |
Definition at line 411 of file AST.cxx.
References children.
Referenced by addChildrenFrom(), AST(), cl_convert_ast(), cl_heapify(), cl_rewrite_captured_idents(), FixDefs(), and trulyHoist().
| void AST::addChildrenFrom | ( | AST_SMART_PTR< AST > | other | ) | [inline] |
| std::string AST::asString | ( | ) | const |
Return pretty-printed representation of this AST in the form of a string.
Definition at line 101 of file ASTaux.cxx.
References PrettyPrint().
Referenced by add_todo(), polyinst(), reRandT(), and Specialize().
| const char * AST::astName | ( | ) | const |
Definition at line 744 of file AST.cxx.
References agt_category, agt_CompilationUnit, agt_definition, agt_eform, agt_expr, agt_expr_or_define, agt_fielditem, agt_if_definition, agt_literal, agt_openclosed, agt_ow, agt_qtype, agt_tc_definition, agt_tvar, agt_type, agt_type_definition, agt_ucon, agt_uselhs, agt_value_definition, agt_var, astType, at_allocREF, at_and, at_AnyGroup, at_apply, at_argVec, at_array, at_array_nth, at_array_ref_nth, at_arrayRefType, at_arrayType, at_begin, at_bitfield, at_bitsizeof, at_block, at_boolLiteral, at_boxedCat, at_byRefType, at_charLiteral, at_closed, at_cond, at_cond_leg, at_cond_legs, at_condelse, at_constraints, at_constructor, at_constructors, at_constType, at_container, at_copyREF, at_declare, at_declares, at_declrepr, at_declstruct, at_declunion, at_defexception, at_define, at_definstance, at_defobject, at_defrepr, at_defstruct, at_deftypeclass, at_defunion, at_deref, at_do, at_dobinding, at_dobindings, at_docString, at_dotest, at_dummyType, at_dup, at_exceptionType, at_field, at_fields, at_fieldType, at_fill, at_floatLiteral, at_fn, at_fnargVec, at_fqCtr, at_frameBindings, at_ident, at_identList, at_identPattern, at_if, at_ifident, at_ifsel, at_import, at_importAs, at_inner_ref, at_interface, at_intLiteral, at_lambda, at_let, at_letbinding, at_letbindings, at_letGather, at_letrec, at_letStar, at_localFrame, at_makevectorL, at_methdecl, at_method_decl, at_method_decls, at_methType, at_mkArrayByref, at_mkClosure, at_module, at_mutableType, at_nth, at_Null, at_object_apply, at_opaqueCat, at_or, at_otherwise, at_primaryType, at_proclaim, at_provide, at_qualType, at_recdef, at_refCat, at_refType, at_reprctr, at_reprctrs, at_reprrepr, at_return_from, at_sel_ctr, at_select, at_setbang, at_setClosure, at_sizeof, at_stringLiteral, at_struct_apply, at_suspend, at_tcapp, at_tcdecls, at_tcmethod_binding, at_tcmethods, at_throw, at_tqexpr, at_try, at_tvlist, at_tyfn, at_typeapp, at_ucon_apply, at_unboxedCat, at_unit, at_usesel, at_usw_leg, at_usw_legs, at_uswitch, at_valCat, at_valType, at_vector, at_vector_nth, at_vectorType, and at_when.
| const char * AST::astTypeName | ( | ) | const |
Definition at line 738 of file AST.cxx.
References astType, and tagName().
Referenced by astChNumError(), astChTypeError(), hoist(), and refize().
| std::string AST::atKwd | ( | ) | const |
For each AST type, return an associated keyword name.
In most cases, the keyword name is simply the ast name. Later versions of astmaker actually emit a string translator, and names can now be assigned in the .ast file. We should consider using that instead of this. That is something for shap to look at.
Definition at line 222 of file ASTimpl.cxx.
References agt_category, agt_CompilationUnit, agt_definition, agt_eform, agt_expr, agt_expr_or_define, agt_fielditem, agt_if_definition, agt_literal, agt_openclosed, agt_ow, agt_qtype, agt_tc_definition, agt_tvar, agt_type, agt_type_definition, agt_ucon, agt_uselhs, agt_value_definition, agt_var, assert(), astType, at_allocREF, at_and, at_AnyGroup, at_apply, at_argVec, at_array, at_array_nth, at_array_ref_nth, at_arrayRefType, at_arrayType, at_begin, at_bitfield, at_bitsizeof, at_block, at_boolLiteral, at_boxedCat, at_byRefType, at_charLiteral, at_closed, at_cond, at_cond_leg, at_cond_legs, at_condelse, at_constraints, at_constructor, at_constructors, at_constType, at_container, at_copyREF, at_declare, at_declares, at_declrepr, at_declstruct, at_declunion, at_defexception, at_define, at_definstance, at_defobject, at_defrepr, at_defstruct, at_deftypeclass, at_defunion, at_deref, at_do, at_dobinding, at_dobindings, at_docString, at_dotest, at_dummyType, at_dup, at_exceptionType, at_field, at_fields, at_fieldType, at_fill, at_floatLiteral, at_fn, at_fnargVec, at_fqCtr, at_frameBindings, at_ident, at_identList, at_identPattern, at_if, at_ifident, at_ifsel, at_import, at_importAs, at_inner_ref, at_interface, at_intLiteral, at_lambda, at_let, at_letbinding, at_letbindings, at_letGather, at_letrec, at_letStar, at_localFrame, at_makevectorL, at_methdecl, at_method_decl, at_method_decls, at_methType, at_mkArrayByref, at_mkClosure, at_module, at_mutableType, at_Null, at_object_apply, at_opaqueCat, at_or, at_otherwise, at_primaryType, at_proclaim, at_provide, at_qualType, at_recdef, at_refCat, at_refType, at_reprctr, at_reprctrs, at_reprrepr, at_return_from, at_sel_ctr, at_select, at_setbang, at_setClosure, at_sizeof, at_stringLiteral, at_struct_apply, at_suspend, at_tcapp, at_tcdecls, at_tcmethod_binding, at_tcmethods, at_throw, at_tqexpr, at_try, at_tvlist, at_tyfn, at_typeapp, at_ucon_apply, at_unboxedCat, at_unit, at_usesel, at_usw_leg, at_usw_legs, at_uswitch, at_valCat, at_valType, at_vector, at_vector_nth, at_vectorType, and at_when.
Referenced by polyinst().
| AST_SMART_PTR<AST>& AST::child | ( | size_t | i | ) | [inline] |
| const AST_SMART_PTR<AST> AST::child | ( | size_t | i | ) | const [inline] |
Definition at line 1208 of file AST.hxx.
References children.
Referenced by cl_convert_ast(), cl_heapify(), clearTypes(), collectHeapifiedArgs(), getCtr(), getDeepCopy(), getID(), getInstanceMethod(), getTrueCopy(), and isValid().
| void AST::clearTypes | ( | ) |
Definition at line 773 of file ASTimpl.cxx.
References child(), children, boost::GC_NULL, scheme, and symType.
| void AST::disown | ( | size_t | s | ) |
The only place this is called is in the parser, and there only to strip documentation strings. That is actually a bad thing to do, since we want to preserve them in the AST, and a literal value really ought to be a perfectly legal (if useless) expression. We should attempt to comment out the body of stripDocString() and see if everything still works. If so, both this and stripDocString() should be removed.
Remove child n from this AST.
Definition at line 721 of file ASTimpl.cxx.
References children.
| shared_ptr< AST > AST::genIdent | ( | const char * | pfx = "tmp", |
|
| const bool | isTV = false | |||
| ) | [static] |
Generate an identifier AST with a newly generated internal name. This will not have any particular type assigned to it, and is intended to be used in the front end passes before the type checker is involved.
Definition at line 70 of file ASTaux.cxx.
| static boost::shared_ptr<AST> AST::genSym | ( | boost::shared_ptr< AST > | lhs, | |
| const char * | pfx = "tmp", |
|||
| const bool | isTV = false | |||
| ) | [static] |
Generate an at_ident AST providing a temporary symbol that is type-compatible with the type of the passed AST lhs.
Referenced by addLB(), cl_convert_ast(), cl_HoistInstLam(), FixDefs(), hoist(), and ssa().
| shared_ptr< AST > AST::getCtr | ( | ) |
Given a union constructor of the form Ctr or union-name.Ctr, returns Ctr.
Definition at line 862 of file ASTimpl.cxx.
References assert(), astType, at_fqCtr, at_ident, child(), and boost::GC_NULL.
| shared_ptr< AST > AST::getDeepCopy | ( | ) |
Make an exact deep copy.
This function clears fields such as symbolDef, type, etc. This is because (1) we don't need them since new ASTs are almost immediately subject to resolver and type check. (2) We sometimes start from a copy of an AST and use it in a way that the original symbolDef/type are no longer valid, so we clear these fields preemptively.
Definition at line 182 of file ASTaux.cxx.
References child(), children, envs, boost::GC_NULL, and make().
Referenced by Use().
| shared_ptr< AST > AST::getID | ( | ) |
Get the unique identifier for this AST.
Definition at line 803 of file ASTimpl.cxx.
References astType, at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_deftypeclass, at_defunion, at_dobinding, at_letbinding, at_proclaim, at_recdef, child(), and boost::GC_NULL.
Referenced by proclaimsAboveDefs(), removeAndReRandT(), and Specialize().
| void AST::getIds | ( | std::ostream & | errStream, | |
| std::vector< boost::shared_ptr< AST > > & | ids, | |||
| bool | getPattern = false | |||
| ) |
Append all ident ASTs from a Binding-pattern to the ids vector.
if getPattern is true, it adds the identPattern ASTs instead of ident ASTs
| shared_ptr< AST > AST::getInstanceMethod | ( | std::string | name | ) |
From a definstance AST, get the definition corresponding to the method `name'.
Definition at line 827 of file ASTimpl.cxx.
References assert(), astType, at_definstance, child(), and boost::GC_NULL.
| shared_ptr< AST > AST::getTrueCopy | ( | ) |
Make an exact copy, deep, including symbolDef, type, etc.
Definition at line 171 of file ASTaux.cxx.
| shared_ptr< const Type > AST::getType | ( | ) | const |
Utility function to call symType->getType().
Definition at line 64 of file ASTaux.cxx.
References symType.
| shared_ptr< Type > AST::getType | ( | ) |
Utility function to call symType->getType().
Definition at line 58 of file ASTaux.cxx.
References symType.
| bool AST::isFnxn | ( | ) |
| bool AST::isGlobal | ( | ) | [inline] |
Definition at line 767 of file AST.hxx.
References flags, and ID_IS_GLOBAL.
Referenced by AlphaRename(), fixWithFqns(), and polyinst().
| bool AST::isIdentType | ( | IdentType | idt | ) |
Definition at line 912 of file ASTimpl.cxx.
References id_interface, id_method, id_object, id_struct, id_tcmethod, id_tvar, id_ucon, id_ucon0, id_union, id_value, idc_apply, idc_ctor, idc_type, idc_uctor, idc_usesel_lhs, idc_value, and identType.
Referenced by isTcMethod(), isUnionLeg(), and Use().
| bool AST::isLiteral | ( | ) |
Definition at line 896 of file ASTimpl.cxx.
References astType, at_boolLiteral, at_charLiteral, at_floatLiteral, at_intLiteral, and at_stringLiteral.
| bool AST::isMemberOfType | ( | AstType | ) | const |
| bool AST::isTcMethod | ( | ) |
Return true IFF this AST is a type class method name identifier.
Definition at line 853 of file ASTimpl.cxx.
References astType, at_ident, id_tcmethod, and isIdentType().
| bool AST::isTopLevelForm | ( | ) |
Definition at line 727 of file ASTimpl.cxx.
References astType, at_declare, at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_defunion, at_importAs, at_proclaim, at_provide, and at_recdef.
| bool AST::isUnionLeg | ( | ) |
Return true IFF this is a AST corresponds to a union leg.
Definition at line 846 of file ASTimpl.cxx.
References assert(), astType, at_ident, idc_uctor, and isIdentType().
Referenced by polyinst(), and Specialize().
| bool AST::isValid | ( | ) | const |
Definition at line 1251 of file AST.cxx.
References agt_category, agt_definition, agt_expr, agt_expr_or_define, agt_fielditem, agt_openclosed, agt_ow, agt_qtype, agt_tvar, agt_type, agt_ucon, agt_uselhs, agt_var, astChNumError(), astChTypeError(), astMembers, astType, at_allocREF, at_and, at_AnyGroup, at_apply, at_argVec, at_array, at_array_nth, at_array_ref_nth, at_arrayRefType, at_arrayType, at_begin, at_bitfield, at_bitsizeof, at_block, at_boolLiteral, at_boxedCat, at_byRefType, at_charLiteral, at_closed, at_cond, at_cond_leg, at_cond_legs, at_condelse, at_constraints, at_constructor, at_constructors, at_constType, at_container, at_copyREF, at_declare, at_declares, at_declrepr, at_declstruct, at_declunion, at_defexception, at_define, at_definstance, at_defobject, at_defrepr, at_defstruct, at_deftypeclass, at_defunion, at_deref, at_do, at_dobinding, at_dobindings, at_docString, at_dotest, at_dummyType, at_dup, at_exceptionType, at_field, at_fields, at_fieldType, at_fill, at_floatLiteral, at_fn, at_fnargVec, at_fqCtr, at_frameBindings, at_ident, at_identList, at_identPattern, at_if, at_ifident, at_ifsel, at_import, at_importAs, at_inner_ref, at_interface, at_intLiteral, at_lambda, at_let, at_letbinding, at_letbindings, at_letGather, at_letrec, at_letStar, at_localFrame, at_makevectorL, at_methdecl, at_method_decl, at_method_decls, at_methType, at_mkArrayByref, at_mkClosure, at_module, at_mutableType, at_nth, at_Null, at_object_apply, at_opaqueCat, at_or, at_otherwise, at_primaryType, at_proclaim, at_provide, at_qualType, at_recdef, at_refCat, at_refType, at_reprctr, at_reprctrs, at_reprrepr, at_return_from, at_sel_ctr, at_select, at_setbang, at_setClosure, at_sizeof, at_stringLiteral, at_struct_apply, at_suspend, at_tcapp, at_tcdecls, at_tcmethod_binding, at_tcmethods, at_throw, at_tqexpr, at_try, at_tvlist, at_tyfn, at_typeapp, at_ucon_apply, at_unboxedCat, at_unit, at_usesel, at_usw_leg, at_usw_legs, at_uswitch, at_valCat, at_valType, at_vector, at_vector_nth, at_vectorType, at_when, child(), children, and ISSET.
| bool AST::leadsToTopLevelForm | ( | ) |
Definition at line 749 of file ASTimpl.cxx.
References astType, at_declare, at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_defunion, at_importAs, at_interface, at_module, at_proclaim, at_provide, and at_recdef.
| static AST_SMART_PTR<AST> AST::make | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| const AST_SMART_PTR< AST > | child1, | |||
| const AST_SMART_PTR< AST > | child2, | |||
| const AST_SMART_PTR< AST > | child3, | |||
| const AST_SMART_PTR< AST > | child4, | |||
| const AST_SMART_PTR< AST > | child5, | |||
| const AST_SMART_PTR< AST > | child6, | |||
| const AST_SMART_PTR< AST > | child7, | |||
| const AST_SMART_PTR< AST > | child8 | |||
| ) | [inline, static] |
| static AST_SMART_PTR<AST> AST::make | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| const AST_SMART_PTR< AST > | child1, | |||
| const AST_SMART_PTR< AST > | child2, | |||
| const AST_SMART_PTR< AST > | child3, | |||
| const AST_SMART_PTR< AST > | child4, | |||
| const AST_SMART_PTR< AST > | child5, | |||
| const AST_SMART_PTR< AST > | child6, | |||
| const AST_SMART_PTR< AST > | child7 | |||
| ) | [inline, static] |
| static AST_SMART_PTR<AST> AST::make | ( | const AstType | at, | |
| const AST_LOCATION_TYPE & | loc, | |||
| const AST_SMART_PTR< AST > | child1, | |||
| const AST_SMART_PTR< AST > | child2, | |||
| const AST_SMART_PTR< AST > | child3, | |||
| const AST_SMART_PTR< AST > | child4, | |||
| const AST_SMART_PTR< AST > | child5, | |||
| const AST_SMART_PTR< AST > | child6 | |||
| ) | [inline, static] |
| static boost::shared_ptr<AST> AST::make | ( | boost::shared_ptr< AST > | ast, | |
| bool | shallowCopyChildren = true | |||
| ) | [inline, static] |
Definition at line 977 of file AST.hxx.
References AST().
Referenced by addLB(), beginSimp(), buildNewDeclaration(), cl_convert_ast(), cl_heapify(), cl_HoistInstLam(), cl_rewrite_captured_idents(), EmitGlobalInitializers(), genIdent(), getClenvUse(), getDeepCopy(), getTrueCopy(), insertMethDecls(), LetWrap(), makeBoolLit(), makeCharLit(), makeFloatLit(), makeIntLit(), makeLetGather(), makeStringLit(), newGrandLet(), propagate_type_annotations(), reprXform(), ssa(), toc(), and typeInfer().
| shared_ptr< AST > AST::makeBoolLit | ( | const sherpa::LToken & | tok | ) | [static] |
Definition at line 59 of file ASTimpl.cxx.
References at_boolLiteral, lr_bool, make(), and sherpa::LToken::str.
| shared_ptr< AST > AST::makeCharLit | ( | const sherpa::LToken & | tok | ) | [static] |
Definition at line 72 of file ASTimpl.cxx.
References at_charLiteral, LitValue::DecodeCharacter(), lr_char, make(), and sherpa::LToken::str.
| shared_ptr< AST > AST::makeFloatLit | ( | const sherpa::LToken & | tok | ) | [static] |
Definition at line 129 of file ASTimpl.cxx.
References at_floatLiteral, lr_float, make(), and sherpa::LToken::str.
| shared_ptr< AST > AST::makeIntLit | ( | const sherpa::LToken & | tok | ) | [static] |
Definition at line 87 of file ASTimpl.cxx.
References at_intLiteral, lr_int, make(), and sherpa::LToken::str.
| shared_ptr< AST > AST::makeStringLit | ( | const sherpa::LToken & | tok | ) | [static] |
Definition at line 212 of file ASTimpl.cxx.
References at_stringLiteral, lr_string, make(), and sherpa::LToken::str.
Referenced by buildLinkedAST().
| size_t AST::nBits | ( | ) |
| int AST::precedence | ( | ) | const |
Definition at line 941 of file ASTimpl.cxx.
References astType, at_arrayType, at_constType, at_exceptionType, at_ident, at_mutableType, at_primaryType, at_refType, at_select, at_typeapp, at_usesel, and at_vectorType.
| void AST::PrettyPrint | ( | bool | decorated | ) | const |
top-level wrapper for the pretty printer
Definition at line 1295 of file BitC-pp.cxx.
References BitcP().
| void AST::PrettyPrint | ( | std::ostream & | out, | |
| bool | showTypes = false, |
|||
| bool | endline = true | |||
| ) | const |
Pretty print this AST to out, annotating each with its type if showTypes is true, and appending a final end of line of endline is true.
Definition at line 1284 of file BitC-pp.cxx.
References BitcP().
Referenced by asString(), and cl_convert_ast().
| void AST::rename | ( | boost::shared_ptr< AST > | from, | |
| std::string | newName | |||
| ) |
| const char * AST::tagName | ( | const AstType | at | ) | [static] |
Definition at line 417 of file AST.cxx.
References agt_category, agt_CompilationUnit, agt_definition, agt_eform, agt_expr, agt_expr_or_define, agt_fielditem, agt_if_definition, agt_literal, agt_openclosed, agt_ow, agt_qtype, agt_tc_definition, agt_tvar, agt_type, agt_type_definition, agt_ucon, agt_uselhs, agt_value_definition, agt_var, at_allocREF, at_and, at_AnyGroup, at_apply, at_argVec, at_array, at_array_nth, at_array_ref_nth, at_arrayRefType, at_arrayType, at_begin, at_bitfield, at_bitsizeof, at_block, at_boolLiteral, at_boxedCat, at_byRefType, at_charLiteral, at_closed, at_cond, at_cond_leg, at_cond_legs, at_condelse, at_constraints, at_constructor, at_constructors, at_constType, at_container, at_copyREF, at_declare, at_declares, at_declrepr, at_declstruct, at_declunion, at_defexception, at_define, at_definstance, at_defobject, at_defrepr, at_defstruct, at_deftypeclass, at_defunion, at_deref, at_do, at_dobinding, at_dobindings, at_docString, at_dotest, at_dummyType, at_dup, at_exceptionType, at_field, at_fields, at_fieldType, at_fill, at_floatLiteral, at_fn, at_fnargVec, at_fqCtr, at_frameBindings, at_ident, at_identList, at_identPattern, at_if, at_ifident, at_ifsel, at_import, at_importAs, at_inner_ref, at_interface, at_intLiteral, at_lambda, at_let, at_letbinding, at_letbindings, at_letGather, at_letrec, at_letStar, at_localFrame, at_makevectorL, at_methdecl, at_method_decl, at_method_decls, at_methType, at_mkArrayByref, at_mkClosure, at_module, at_mutableType, at_nth, at_Null, at_object_apply, at_opaqueCat, at_or, at_otherwise, at_primaryType, at_proclaim, at_provide, at_qualType, at_recdef, at_refCat, at_refType, at_reprctr, at_reprctrs, at_reprrepr, at_return_from, at_sel_ctr, at_select, at_setbang, at_setClosure, at_sizeof, at_stringLiteral, at_struct_apply, at_suspend, at_tcapp, at_tcdecls, at_tcmethod_binding, at_tcmethods, at_throw, at_tqexpr, at_try, at_tvlist, at_tyfn, at_typeapp, at_ucon_apply, at_unboxedCat, at_unit, at_usesel, at_usw_leg, at_usw_legs, at_uswitch, at_valCat, at_valType, at_vector, at_vector_nth, at_vectorType, and at_when.
Referenced by astChTypeError(), astTypeName(), XMLd(), and XMLp().
| shared_ptr< AST > AST::Use | ( | ) |
Given a defining occurrence, return a new AST for a use occurrence.
Definition at line 125 of file ASTaux.cxx.
References assert(), astType, at_ident, getDeepCopy(), id_tvar, isIdentType(), MASK_FLAGS_FROM_USE, symbolDef, and symType.
Referenced by cl_convert_ast().
Definition at line 741 of file AST.hxx.
Referenced by add_relevant_items_todo(), addCompType(), AlphaRename(), AST(), astName(), astTypeName(), atKwd(), checkInfTypedValues(), cl_convert_ast(), cl_heapify(), cl_rewrite_captured_idents(), clearConstraints(), collectHeapifiedArgs(), findusedef(), FixDefs(), fixWithFqns(), getAllDefs(), getCtr(), getID(), getInstanceMethod(), getLetintoLetStream(), getValuesIntoMainStream(), hoist(), isLiteral(), isMemberOfType(), isTcMethod(), isTopLevelForm(), isUnionLeg(), isValid(), lbMustNotSurvive(), leadsToTopLevelForm(), mangleIDs(), markPreludeDefs(), markRecBound(), polyinst(), precedence(), proclaimsAboveDefs(), refize(), refSub(), removeUnreached(), Specialize(), sub(), substitute(), trulyHoist(), and Use().
| ::std::vector<AST_SMART_PTR<AST> > AST::children |
Definition at line 744 of file AST.hxx.
Referenced by add_relevant_items_todo(), addChild(), addCompType(), addType(), AlphaRename(), buildLinkedAST(), checkInfTypedValues(), child(), cl_convert(), cl_convert_ast(), cl_heapify(), cl_rewrite_captured_idents(), clearConstraints(), clearTypes(), clearusedef(), collectHeapifiedArgs(), disown(), findusedef(), FixDefs(), fixWithFqns(), getAllDefs(), getDeepCopy(), getLetintoLetStream(), getTrueCopy(), getTypesIntoMainStream(), getValuesIntoMainStream(), hoist(), isValid(), lbMustNotSurvive(), mangleIDs(), markPreludeDefs(), markRecBound(), moveTypesUp(), polyinst(), proclaimsAboveDefs(), refize(), refSub(), removeUnreached(), Specialize(), sub(), substitute(), and trulyHoist().
On a definition AST: pointer to the definitive declaration (the first one). Set by the resolver in Symtab.cxx.
Definition at line 788 of file AST.hxx.
Referenced by AST(), and Specialize().
| boost::shared_ptr<AST> AST::defbps |
| boost::shared_ptr<AST> AST::defForm |
Pointer to defining form.
defForm has context sensitive meaning. This is basically a hack in the absence of parent pointers, where I must reach back into the definition and get the defining form, or some form of a containing datastructure.
In the case of top-level expressions, we use it to get the entire defining form from the identifier being defined
(def defIdent ... ) ^ | |________| defForm
In the case of let-expressions: (The quoted phrases are just ast-types not syntax.)
_______________ __________________ | defForm | | defForm | v | v | (define ... (let .. ("letbindings" ("letbinding" ident ... )))) ^ | ^ | |_____________| |_______________| defForm defForm
___________ | | v | (switch ... ("usw_leg" id ...) ...) ^ | |____| _____ __________ | | | | v | v | (do ("dobindings" ("dobinding" id ...) ...) ^ | |_____|
Definition at line 853 of file AST.hxx.
Referenced by addCompType(), AST(), polyinst(), and Specialize().
On a declaration AST only: if a definition for it has been seen, then defn points to the definition. Set by the resolver in Symtab.cxx.
Definition at line 784 of file AST.hxx.
Referenced by AST(), polyinst(), and Specialize().
A set of environments associated with this ast.
Definition at line 808 of file AST.hxx.
Referenced by getDeepCopy().
| std::string AST::externalName |
| size_t AST::field_bits |
If this is a global identifier, fqn is its canonical fully qualified name. The interface component of an fqn is the IFNAME of the interface in which the symbol was defined. the ident component is the identifier under which the symbol was defined at the point of its original definition, which may or may not be the name that was bound in an importing environment (because USE may have aliased it under a different name).
Definition at line 797 of file AST.hxx.
Referenced by cl_convert_ast(), cl_heapify(), findusedef(), fixWithFqns(), and refize().
| bool AST::isDecl |
| unsigned long AST::litBase |
| AST_LOCATION_TYPE AST::loc |
Definition at line 743 of file AST.hxx.
Referenced by AST(), astChNumError(), astChTypeError(), checkInfTypedValues(), cl_convert_ast(), cl_heapify(), cl_rewrite_captured_idents(), FixDefs(), hoist(), moveTypesUp(), polyinst(), proclaimsAboveDefs(), refize(), refSub(), setupTypApp(), Specialize(), sub(), and trulyHoist().
| boost::shared_ptr<AST> AST::parentLB |
Let-Binding within which this at_letbindings is contained. In the case of the outer-most let-bindings, this field points to the top-level define/recdef. This flag is set everytime the resolver is called, so there is no need to worry while cloning an AST.
Definition at line 907 of file AST.hxx.
Referenced by AST().
| ::std::string AST::s |
Definition at line 742 of file AST.hxx.
Referenced by AlphaRename(), AST(), cl_convert_ast(), cl_heapify(), fixWithFqns(), getNewName(), getTokenString(), mangleIDs(), polyinst(), refize(), Specialize(), and substitute().
| boost::shared_ptr<TypeScheme> AST::scheme |
| boost::shared_ptr<AST> AST::stCtr |
Union Constructors with identical layout must share the same structure type since they can be used in the same switch leg. Structures equality is nominal in BitC (structures are identified by name, not by identical components). Therefore, if at a second constructor, a previously typed structure with identical structure is found, the new constructor uses the structure defined at the old structure and stores a pointer to that constructor in stCtr.
| boost::shared_ptr<TypeScheme> AST::stSigma |
TypeScheme for the Structure definition corresponding to a union constructor.
| boost::shared_ptr<AST> AST::symbolDef |
Definition at line 763 of file AST.hxx.
Referenced by addCompType(), AlphaRename(), AST(), cl_convert_ast(), findusedef(), fixWithFqns(), polyinst(), refSub(), Specialize(), sub(), substitute(), and Use().
| boost::shared_ptr<Type> AST::symType |
Definition at line 762 of file AST.hxx.
Referenced by AST(), checkInfTypedValues(), cl_convert_ast(), clearTypes(), getType(), getValuesIntoMainStream(), isFnxn(), polyinst(), refize(), setupTypApp(), Specialize(), trulyHoist(), and Use().
| boost::shared_ptr<Type> AST::tagType |
| size_t AST::total_fill |
| boost::shared_ptr<AST> AST::tvarLB |
| size_t AST::unin_discm |
1.4.7