This module contains classes and mix-ins to compile various stages of a little language using builder actions to represent programs as trees and visitors to interpret, check types, and compile. The details are discussed in chapter 11 and appendix D.
A tree consists of nodes represented as nested Array objects,
each consisting of a string tag selecting a method of a visitor,
followed by zero or more nodes or other argument values.
visit cannot be a tag.
A tree node can have .lineno and .type properties referring to the
source line number and the type (bool, number, or string) delivered
by the node. visitor._dump(node) displays
the properties if they exist.
The module assumes that there are globalThis definitions
of puts() for output and prompt() for num which are available to eval().
Classes
Mixins
- Build_Bool
- Build_Cast
- Build_Cmps
- Build_Dcl
- Build_Names
- Build_Number
- Build_RD
- Build_Stmts
- Build_String
- Check_Bool
- Check_Cast
- Check_Cmps
- Check_Dcl
- Check_Names
- Check_Number
- Check_Stmts
- Check_String
- Code_Bool
- Code_Cast
- Code_Cmps
- Code_Dcl
- Code_Names
- Code_Number
- Code_Stmts
- Code_String
- Compile
- Eval_Bool
- Eval_Cast
- Eval_Cmps
- Eval_Dcl
- Eval_Names
- Eval_Number
- Eval_Stmts
- Eval_String
- Main
- Symbols
Members
Methods
-
Bnzero()
-
stack: ... bool -> ... | pc: bool? a -
Cast()
-
stack: ... a -> ... cast a -
Concat()
-
stack: ... a b -> ... a+b -
IfFalse()
-
stack: ... bool -> ... bool | pc: !bool? a -
IfTrue()
-
stack: ... bool -> ... bool | pc: bool? a -
InputString()
-
stack: ... -> ... val -
Len()
-
stack: ... a -> ... a.length -
Not()
-
stack: ... a -> ... !a -
Power()
-
stack: ... a b -> ... a**b