Tensor Comprehensions
|
Go to the source code of this file.
Classes | |
struct | lang::Tree |
struct | lang::String |
struct | lang::Number |
struct | lang::Bool |
struct | lang::Compound |
struct | lang::pretty_tree |
tree pretty printer More... | |
Namespaces | |
lang | |
Typedefs | |
using | lang::TreeRef = std::shared_ptr< Tree > |
using | lang::TreeList = std::vector< TreeRef > |
Tree's are used to represent all forms of TC IR, pre- and post-typechecking. Rather than have a full class hierarchy for all TC statements, Trees are a slight variation of Lisp S-expressions. for instance the expression a*b+1 is represented as: (+ (* (ident a) (ident b)) (const 1)) Atoms like 'a', 'b', and '1' are represented by subclasses of Tree which define stringValue() and doubleValue(). Everything else is a Compound object, which has a 'kind' that is a token from Lexer.h's TokenKind enum, and contains a list of subtrees. Like TokenKind single-character operators like '+' are representing using the character itself, so add.kind() == '+'. Compound objects are also always associated with a SourceRange for reporting error message.
Memory management of trees is done using shared_ptr.