Basic Expressions

Literals

As we’ve seen earlier, literals are written as follows:

LIT(1)                       // 1
LIT(1L)                      // 1L
LIT(1.23)                    // 1.23
LIT(1.23F)                   // 1.23F
LIT('H')                     // 'H'
LIT("H")                     // "H"
LIT('Sym)                    // 'Sym
TRUE                         // true
FALSE                        // false
NULL                         // null
UNIT                         // ()

Simple Names

Simple names are written using REF(sym|"x") to refer to values and methods that immediately available in the current scope:

object sym {
  val x = RootClass.newValue("x")
  val y = RootClass.newValue("y") 
}

REF("x")                     // x
REF(sym.x)                   // x

Selection

To refer to other values and methods, selections are written by calling DOT(sym|"y") either on a symbol or on a REF(sym|"x"). This returns an intermediate structure that can turn into a Tree by calling tree method or by implicit conversion:

(sym.x DOT sym.y).Tree       // x.y
(sym.x DOT "y": Tree)        // x.y
(REF("x") DOT "y": Tree)     // x.y

This

References to this are written using THIS or THIS(sym|"C"):

THIS                         // this
THIS(sym.Address)            // Address.this

Super

References to super are written using SUPER or SUPER(sym|"C"). This also returns an intermediate structure that can turn into a Tree by calling tree method or via implicit conversion:

(SUPER: Tree)                // super
(SUPER("C"): Tree)           // C.super

To add type parameter to super, call APPLYTYPE(sym|"T"):

SUPER APPLYTYPE "T"          // super[T]