TreeModule

amyc.ast.TreeModule
trait TreeModule

A polymorphic module containing definitions of Amy trees.

This trait represents either nominal trees (where names have not been resolved) or symbolic trees (where names/qualified names) have been resolved to unique identifiers. This is done by having two type fields within the module, which will be instantiated differently by the two different modules.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object NominalTreeModule.type
object SymbolicTreeModule.type

Members list

Type members

Classlikes

case class AbstractClassDef(name: Name) extends ClassOrFunDef

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Definition
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class BooleanLiteral(value: Boolean) extends Literal[Boolean]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Literal[Boolean]
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Call(qname: QualifiedName, args: List[Expr]) extends Expr

Function/constructor call

Function/constructor call

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class CaseClassDef(name: Name, fields: List[ParamDef], parent: Name) extends ClassOrFunDef

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Definition
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class CaseClassPattern(constr: QualifiedName, args: List[Pattern]) extends Pattern

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Pattern
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
trait ClassOrFunDef extends Definition

Attributes

Supertypes
trait Definition
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
Known subtypes
case class ClassTypeTree(qname: QualifiedName) extends TypeTree

Represent a ClassType such as O.Option or String

Represent a ClassType such as O.Option or String

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait TypeTree
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
sealed trait Definition extends Tree

TODO

TODO

Attributes

Supertypes
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Known subtypes
class CaseClassDef
class FunDef
class ModuleDef
class ParamDef
Show all
case class EmptyExpr() extends Expr

Empty expression

Empty expression

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Error(msg: Expr) extends Expr

Represents a computational error; prints its message, then exits

Represents a computational error; prints its message, then exits

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
sealed trait Expr extends Tree

Base type for all the expressions in Amy

Base type for all the expressions in Amy

Attributes

Supertypes
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Known subtypes
class Call
class EmptyExpr
class Error
class FunRef
class InfixCall
class Ite
class Let
trait Literal[T]
class IntLiteral
class UnitLiteral
class Match
class Neg
class Not
class Sequence
class Variable
Show all
case class FunDef(name: Name, params: List[ParamDef], retType: TypeTree, body: Expr) extends ClassOrFunDef

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Definition
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class FunRef(name: QualifiedName) extends Expr

Function references (Module::function_name)

Function references (Module::function_name)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class FunctionTypeTree(args: List[TypeTree], rte: TypeTree) extends TypeTree

Represents a FunctionType such as (String) => String

Represents a FunctionType such as (String) => String

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait TypeTree
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class IdPattern(name: Name) extends Pattern

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Pattern
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class InfixCall(lhs: Expr, op: Name, rhs: Expr) extends Expr

Represents an Infix call to a function For now, we only use it for operators.

Represents an Infix call to a function For now, we only use it for operators.

It should be desugared to a Call(op, List(lhs, rhs))

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class IntLiteral(value: Int) extends Literal[Int]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Literal[Int]
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Ite(cond: Expr, thenn: Expr, elze: Expr) extends Expr

If-then-else

If-then-else

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Let(df: ParamDef, value: Expr, body: Expr) extends Expr

Local variable definition

Local variable definition

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
sealed trait Literal[+T](value: T) extends Expr

Represent a Literal (Int, Boolean, String or Unit)

Represent a Literal (Int, Boolean, String or Unit)

Attributes

Supertypes
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
Known subtypes
case class LiteralPattern[+T](lit: Literal[T]) extends Pattern

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Pattern
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Match(scrut: Expr, cases: List[MatchCase]) extends Expr

Pattern matching

Pattern matching

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class MatchCase(pat: Pattern, expr: Expr) extends Tree

Cases and patterns for Match expressions

Cases and patterns for Match expressions

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class ModuleDef(name: Name, defs: List[ClassOrFunDef], optExpr: Option[Expr]) extends Definition

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Definition
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Neg(e: Expr) extends Expr

Represents a -(expr)

Represents a -(expr)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Not(e: Expr) extends Expr

Represents a !(expr)

Represents a !(expr)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class ParamDef(name: Name, tt: TypeTree) extends Definition

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Definition
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
sealed abstract class Pattern extends Tree

Base Type to represent a pattern

Base Type to represent a pattern

Attributes

Supertypes
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Known subtypes
case class Program(modules: List[ModuleDef]) extends Tree

Root of the AST, we only have one Program with multiple modules

Root of the AST, we only have one Program with multiple modules

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Sequence(e1: Expr, e2: Expr) extends Expr

The ; operator

The ; operator

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class StringLiteral(value: String) extends Literal[String]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Literal[String]
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class TTypeTree(tpe: Type) extends TypeTree

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait TypeTree
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
sealed trait Tree extends Positioned

Base type for all the AST nodes

Base type for all the AST nodes

Attributes

Supertypes
trait Positioned
class Object
trait Matchable
class Any
Known subtypes
trait Definition
class CaseClassDef
class FunDef
class ModuleDef
class ParamDef
trait Expr
class Call
class EmptyExpr
class Error
class FunRef
class InfixCall
class Ite
class Let
trait Literal[T]
class IntLiteral
class UnitLiteral
class Match
class Neg
class Not
class Sequence
class Variable
class MatchCase
class Pattern
class IdPattern
class LiteralPattern[T]
class Program
trait TypeTree
class TTypeTree
Show all
trait TypeTree extends Tree

Base Type to represent type node

Base Type to represent type node

Attributes

Supertypes
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Known subtypes
case class UnitLiteral() extends Literal[Unit]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Literal[Unit]
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class Variable(name: Name) extends Expr

Represents an access to a variable

Represents an access to a variable

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all
case class WildcardPattern() extends Pattern

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Pattern
trait Tree
trait Positioned
class Object
trait Matchable
class Any
Show all

Types

type Name

Represents the type for the name for this tree module.

Represents the type for the name for this tree module.

Attributes

Represents a name within an module

Represents a name within an module

Attributes