trait CCodeGenerator extends L3.CCodeGenerator with TypeAnalyser
- Alphabetic
- By Inheritance
- CCodeGenerator
- TypeAnalyser
- SymbolTable
- CCodeGenerator
- TypeAnalyser
- NameAnalyser
- SymbolTable
- NameAnalyser
- TypeAnalyser
- TypeAnalyser
- CCodeGenerator
- CCodeGenerator
- TypeAnalyser
- NameAnalyser
- SymbolTable
- SymbolTable
- Environments
- Analyser
- CCodeGenerator
- Translator
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
Builtin
extends Named
Marker trait for all built-in entities.
Marker trait for all built-in entities.
- Definition Classes
- SymbolTable
-
case class
BuiltinType
(ident: String) extends Type with Named with Builtin with Product with Serializable
A built-in type with an implicit definition that the compiler must have special knowledge about.
A built-in type with an implicit definition that the compiler must have special knowledge about. This mechanism is necessary since the built-in types cannot be defined using source concepts.
- Definition Classes
- SymbolTable
-
case class
Constant
(ident: String, decl: ConstDecl) extends Entity with NamedEntity with Product with Serializable
A user-defined constant entity represented by a constant declaration.
A user-defined constant entity represented by a constant declaration.
- Definition Classes
- SymbolTable
-
case class
IntegerValue
(ident: String, tipe: Type, value: Int) extends Entity with NamedEntity with Builtin with Product with Serializable
A built-in value of some type that is represented by a particular integer value.
A built-in value of some type that is represented by a particular integer value. The type does not have to be INTEGER. In other words, this value cannot be defined using a constant declaration so the compiler has to have special knowledge of them.
- Definition Classes
- SymbolTable
-
case class
Module
(ident: String, decl: ModuleDecl) extends Entity with NamedEntity with Product with Serializable
A user-defined module represented by a module declaration.
A user-defined module represented by a module declaration.
- Definition Classes
- SymbolTable
-
abstract
class
Type
extends Entity
An entity representing by a user-provided type declaration.
An entity representing by a user-provided type declaration.
- Definition Classes
- SymbolTable
-
case class
UserType
(ident: String, tipe: TypeDecl) extends Type with Named with Product with Serializable
A user-defined type.
A user-defined type.
- Definition Classes
- SymbolTable
-
case class
Variable
(ident: String, tipe: TypeDef) extends Entity with NamedEntity with Product with Serializable
A variable entity including a reference to its types' definition.
A variable entity including a reference to its types' definition.
- Definition Classes
- SymbolTable
-
case class
BuiltinProc
(ident: String, params: Seq[ParamInfo]) extends Entity with NamedEntity with Builtin with Product with Serializable
A built-in procedure with its parameter information.
A built-in procedure with its parameter information.
- Definition Classes
- SymbolTable
-
case class
ParamInfo
(mode: Mode, ident: String, tipe: SymbolTable.Type) extends Product with Serializable
Information about a particular parameter.
Information about a particular parameter. Similar to Parameter but the type has been replaced with its definition.
- Definition Classes
- SymbolTable
-
case class
Parameter
(mode: Mode, varr: SymbolTable.Variable) extends Entity with NamedEntity with Product with Serializable
A parameter is a variable augmented with a passing mode.
A parameter is a variable augmented with a passing mode.
- Definition Classes
- SymbolTable
-
case class
Procedure
(ident: String, decl: ProcDecl) extends Entity with NamedEntity with Product with Serializable
A procedure entity represented by a procedure declaration.
A procedure entity represented by a procedure declaration.
- Definition Classes
- SymbolTable
-
type
Environment = List[Scope]
- Definition Classes
- Environments
-
trait
Named extends AnyRef
- Definition Classes
- Environments
-
trait
NamedEntity extends Entity with Named
- Definition Classes
- Environments
-
type
Scope = Map[String, Entity]
- Definition Classes
- Environments
-
case class
ArrayType
(size: Int, elemtype: SymbolTable.Type) extends Type with Product with Serializable
An array type with the given size and element type.
An array type with the given size and element type. Setting size to zero and elemtype to the unknown type means an arbitrary array type.
- Definition Classes
- SymbolTable
-
case class
Field
(ident: String, tipe: SymbolTable.Type) extends Entity with Product with Serializable
A record field.
A record field.
- Definition Classes
- SymbolTable
-
case class
RecordType
(fields: Seq[Field]) extends Type with Product with Serializable
A record with the given fields.
A record with the given fields.
- Definition Classes
- SymbolTable
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
lazy val
basetype: (Expression) ⇒ Type
The actual type of an expression following type aliases.
The actual type of an expression following type aliases.
- Definition Classes
- TypeAnalyser
-
lazy val
booleanType: BuiltinType
Built-in Boolean type.
Built-in Boolean type.
- Definition Classes
- SymbolTable
-
def
checkNonLocalVarAccess(u: IdnUse): Messages
Check for non-local variable and procedure accesses.
Check for non-local variable and procedure accesses. In the L3 language non-local variable accesses are disallowed, unless they are to a variable at the top level. Non-local procedure accesses are just disallowed.
- Definition Classes
- NameAnalyser
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
lazy val
decltype: (TypeDecl) ⇒ Type
The built-in type associated with a type declaration.
The built-in type associated with a type declaration.
- Definition Classes
- TypeAnalyser
-
def
defenv: Environment
The default environment.
The default environment.
- Definition Classes
- SymbolTable
-
def
defenvPairs: Seq[(String, Entity)]
The default environment with pre-defined procedures added.
The default environment with pre-defined procedures added.
- Definition Classes
- SymbolTable → SymbolTable
-
def
define(env: Environment, i: String, e: Entity): Environment
- Definition Classes
- Environments
-
lazy val
deftype: (TypeDef) ⇒ Type
The type given by a type definition.
The type given by a type definition.
- Definition Classes
- TypeAnalyser
-
def
deftypeDef: (TypeDef) ⇒ Type
- Definition Classes
- TypeAnalyser → TypeAnalyser
-
def
enter(env: Environment): Environment
- Definition Classes
- Environments
-
lazy val
entity: (Identifier) ⇒ Entity
The program entity referred to by an identifier definition or use.
The program entity referred to by an identifier definition or use. In the case of a definition it's the thing being defined, so define it to be a reference to the declaration. If it's already defined, return a entity that indicates a multiple definition. In the case of a use, it's the thing defined elsewhere that is being referred to here, so look it up in the environment.
- Definition Classes
- NameAnalyser
-
def
entityFromDecl(n: IdnDef, i: String): Entity
The entity for an identifier definition as given by its declaration context.
The entity for an identifier definition as given by its declaration context.
- Definition Classes
- TypeAnalyser → NameAnalyser → NameAnalyser
-
lazy val
env: Chain[SourceTree, Environment]
The environment containing bindings for all identifiers visible at the given node.
The environment containing bindings for all identifiers visible at the given node. It starts at the module declaration with the default environment. At blocks we enter a nested scope which is removed on exit from the block. At constant and type declarations the left-hand side binding is not in scope on the right-hand side. Each identifier definition just adds its binding to the chain. The envout cases for assignment and expression mean that we don't need to traverse into those constructs, since declarations can't occur there.
- Definition Classes
- NameAnalyser
-
def
envin(in: (SourceTree) ⇒ Environment): ==>[SourceTree, Environment]
- Definition Classes
- NameAnalyser → NameAnalyser
-
def
envinl(in: (SourceTree) ⇒ Environment): ==>[SourceTree, Environment]
Blocks that are immediately inside procedure decls do not introduce new scopes since the procedure itself does.
Blocks that are immediately inside procedure decls do not introduce new scopes since the procedure itself does. This computation overrides the one earlier that pushes a scope for all blocks. Don't include the procedure name in the scope of its own body.
- Definition Classes
- NameAnalyser
-
def
envout(out: (SourceTree) ⇒ Environment): ==>[SourceTree, Environment]
- Definition Classes
- NameAnalyser → NameAnalyser
-
def
envoutl(out: (SourceTree) ⇒ Environment): ==>[SourceTree, Environment]
Similarly for envin we don't need to leave a scope for a procedure block, since we didn't enter one.
Similarly for envin we don't need to leave a scope for a procedure block, since we didn't enter one. The IdnDef that is for a ProcDecl needs to be in the outer scope, but not in the scope of its own body. All arguments and local declarations go in the nested scope.
- Definition Classes
- NameAnalyser
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
errors: (SourceTree) ⇒ Messages
The semantic errors for a tree.
The semantic errors for a tree.
- Definition Classes
- Analyser
-
def
errorsDef(n: SourceTree): Messages
The error checking for this level.
The error checking for this level.
- Definition Classes
- TypeAnalyser → TypeAnalyser → NameAnalyser → TypeAnalyser → TypeAnalyser → NameAnalyser → Analyser
-
lazy val
expconst: (Expression) ⇒ Boolean
Is an expression expected to be constant or not? Either the expression is the root of an expected constant expression or its parent expression is expected to be constant.
Is an expression expected to be constant or not? Either the expression is the root of an expected constant expression or its parent expression is expected to be constant.
- Definition Classes
- NameAnalyser
-
lazy val
exptype: (Expression) ⇒ Type
The type expected of an expression as defined by its context.
The type expected of an expression as defined by its context.
- Definition Classes
- TypeAnalyser
-
def
exptypeDef: (Expression) ⇒ Type
Use of arrays and records is dealt with separately, not via the expected type.
Use of arrays and records is dealt with separately, not via the expected type.
- Definition Classes
- TypeAnalyser → TypeAnalyser → TypeAnalyser → TypeAnalyser → TypeAnalyser
-
lazy val
falseConstant: IntegerValue
Built-in false constant.
Built-in false constant.
- Definition Classes
- SymbolTable
-
def
fieldListsToFields(fls: Seq[FieldList]): Seq[Field]
- Definition Classes
- TypeAnalyser
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hasField(t: Type, f: String): Boolean
Is a given type a record type containing a field called f?
Is a given type a record type containing a field called f?
- Definition Classes
- SymbolTable
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
lazy val
idntype: (IdnUse) ⇒ Type
The type of the entity denoted by an identifier use.
The type of the entity denoted by an identifier use.
- Definition Classes
- TypeAnalyser
-
def
idntypeDef: (IdnUse) ⇒ Type
The type of a parameter is the type of its underlying variable.
The type of a parameter is the type of its underlying variable.
- Definition Classes
- TypeAnalyser → TypeAnalyser
-
lazy val
integerType: BuiltinType
Built-in integer type.
Built-in integer type.
- Definition Classes
- SymbolTable
-
def
isArray(e: Entity): Boolean
Return true if the entity is erroneous or is an array.
Return true if the entity is erroneous or is an array.
- Definition Classes
- SymbolTable
-
def
isBoolean(e: Type): Boolean
Return true if the given type is Boolean or an unknown type.
Return true if the given type is Boolean or an unknown type.
- Definition Classes
- SymbolTable
-
def
isCompatible(tipe: Type, exptype: Type): Boolean
Array and record types are only compatible if they have the same name.
Array and record types are only compatible if they have the same name.
- Definition Classes
- TypeAnalyser → TypeAnalyser
-
def
isConstant(e: Entity): Boolean
Return true if the entity is erroneous or is a constant.
Return true if the entity is erroneous or is a constant.
- Definition Classes
- SymbolTable
-
def
isDefinedInEnv(env: Environment, i: String): Boolean
- Definition Classes
- Environments
-
def
isDefinedInInner(env: Environment, i: String): Boolean
- Definition Classes
- Environments
-
def
isDefinedInOuter(env: Environment, i: String): Boolean
- Definition Classes
- Environments
-
def
isDefinedInScope(scope: Scope, i: String): Boolean
- Definition Classes
- Environments
-
def
isDefinedInScope(env: Environment, i: String): Boolean
- Definition Classes
- Environments
-
def
isError(e: Entity): Boolean
Return true if the entity is an error, false otherwise.
Return true if the entity is an error, false otherwise.
- Definition Classes
- SymbolTable
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isInteger(e: Type): Boolean
Return true if the given type is integer or an unknown type.
Return true if the given type is integer or an unknown type.
- Definition Classes
- SymbolTable
-
def
isLvalue(l: Expression): Boolean
Return true if the expression can legally appear on the left-hand side of an assignment statement.
Return true if the expression can legally appear on the left-hand side of an assignment statement. At this level only allow identifiers of variables or things we don't know anything about. The true default is used so that this computation can be used in redefinitions.
- Definition Classes
- NameAnalyser
-
def
isModule(e: Entity): Boolean
Return true if the entity is erroneous or is a module.
Return true if the entity is erroneous or is a module.
- Definition Classes
- SymbolTable
-
def
isNotArray(e: Entity): Boolean
Return true if the entity is erroneous or is not an array.
Return true if the entity is erroneous or is not an array.
- Definition Classes
- SymbolTable
-
def
isNotRecord(e: Entity): Boolean
Return true if the entity is erroneous or is not a record.
Return true if the entity is erroneous or is not a record.
- Definition Classes
- SymbolTable
-
def
isRecord(e: Entity): Boolean
Return true if the entity is erroneous or is a record.
Return true if the entity is erroneous or is a record.
- Definition Classes
- SymbolTable
-
def
isRvalue(r: IdnExp): Boolean
Return true if the identifier is an r-value and hence its value can be used (ie.
Return true if the identifier is an r-value and hence its value can be used (ie. it's erroneous or is a constant, value or variable).
- Definition Classes
- NameAnalyser
-
def
isType(e: Entity): Boolean
Return true if the entity is erroneous or is a type.
Return true if the entity is erroneous or is a type.
- Definition Classes
- SymbolTable
-
def
isVariable(e: Entity): Boolean
Parameters are variables too.
Parameters are variables too.
- Definition Classes
- SymbolTable → SymbolTable
-
lazy val
isconst: (Expression) ⇒ Boolean
Is an expression constant or not? Unknown entities are constant.
Is an expression constant or not? Unknown entities are constant. Strictly speaking we only need to support integer expressions here, but we treat Boolean ones as constant in the same way so that we avoid spurious errors. Type analysis will reject Boolean constant expressions anyway.
- Definition Classes
- NameAnalyser
-
def
leave(env: Environment): Environment
- Definition Classes
- Environments
-
lazy val
level: (SourceTree) ⇒ Int
Level of a node considering the module level to be zero and incrementing each time we enter a nested procedure declaration.
Level of a node considering the module level to be zero and incrementing each time we enter a nested procedure declaration.
- Definition Classes
- NameAnalyser
-
def
lookup(env: Environment, i: String, e: Entity, scope: Boolean): Entity
- Definition Classes
- Environments
-
def
mangle(s: String): String
Mangle an Oberon name so it is safe to be used at the C level.
Mangle an Oberon name so it is safe to be used at the C level. We assume that there are no C names with "ob_" prefix.
- Definition Classes
- CCodeGenerator
-
val
nameCounter: Counter
- Definition Classes
- Environments
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
lazy val
numparams: (IdnUse) ⇒ Option[Int]
Calculate the number of parameters to a procedure.
Calculate the number of parameters to a procedure. Return None if the identifier use does not denote a procedure.
- Definition Classes
- TypeAnalyser
-
lazy val
parameters: (Identifier) ⇒ Option[Seq[ParamInfo]]
Calculate the parameter information list for a procedure.
Calculate the parameter information list for a procedure. If it's a built-in we have the information already, otherwise we need to work it out from the declaration. Returns None if the entity is not a procedure.
- Definition Classes
- TypeAnalyser
-
def
parammode(u: IdnUse, i: Int): Mode
Return the ith parameter mode of the procedure denoted by u (counting from one).
Return the ith parameter mode of the procedure denoted by u (counting from one). If u is not a procedure or has less than i parameters, return a value mode, since that mode places no constraints on its actual parameter.
- Definition Classes
- TypeAnalyser
-
def
paramtype(u: IdnUse, i: Int): Type
Return the ith parameter type of the procedure denoted by u (counting from one).
Return the ith parameter type of the procedure denoted by u (counting from one). If u is not a procedure or has less than i parameters, return an unknown type.
- Definition Classes
- TypeAnalyser
-
lazy val
readProc: BuiltinProc
The built-in Read procedure.
The built-in Read procedure.
- Definition Classes
- SymbolTable
-
def
resetEnvironments(): Unit
- Definition Classes
- Environments
-
lazy val
rootconstexp: (Expression) ⇒ Boolean
Is this expression the root of what is expected to be a constant expression? At this level only expressions on the RHS of a constant declaration have this property.
Is this expression the root of what is expected to be a constant expression? At this level only expressions on the RHS of a constant declaration have this property.
- Definition Classes
- NameAnalyser
-
def
rootconstexpDef: (Expression) ⇒ Boolean
- Definition Classes
- TypeAnalyser → NameAnalyser → NameAnalyser
-
def
rootenv(bindings: (String, Entity)*): Environment
- Definition Classes
- Environments
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
lazy val
tipe: (Expression) ⇒ Type
The type of an expression.
The type of an expression.
- Definition Classes
- TypeAnalyser
-
def
tipeDef: (Expression) ⇒ Type
- Definition Classes
- TypeAnalyser → TypeAnalyser
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
translate(e: Expression): CExpression
Uses of array parameter names don't need to be dereferenced.
Uses of array parameter names don't need to be dereferenced.
- Definition Classes
- CCodeGenerator → CCodeGenerator → CCodeGenerator
-
def
translate(t: Type): CType
Add translation for array and record types.
Add translation for array and record types.
- Definition Classes
- CCodeGenerator → CCodeGenerator
-
def
translate(s: Statement): CStatement
Add translation of call statements.
Add translation of call statements.
- Definition Classes
- CCodeGenerator → CCodeGenerator → CCodeGenerator → CCodeGenerator → Translator
-
def
translate(d: Declaration): Seq[CDeclaration]
Add translation of procedure declarations.
Add translation of procedure declarations.
- Definition Classes
- CCodeGenerator → CCodeGenerator → CCodeGenerator → Translator
-
def
translate(m: ModuleDecl): CProgram
Add STDIO header since output is now possible.
Add STDIO header since output is now possible.
- Definition Classes
- CCodeGenerator → CCodeGenerator → Translator
-
def
translate(eis: Seq[(Expression, Block)], oe: Option[Block]): CStatement
Translation of expression, block pairs from an IF statement into cascading C IFs.
Translation of expression, block pairs from an IF statement into cascading C IFs.
- Definition Classes
- CCodeGenerator
-
def
translateActualParam(p: Expression, mode: Mode): CExpression
Array parameters get passed by reference, so we don't need to insert addressing operations for VAR.
Array parameters get passed by reference, so we don't need to insert addressing operations for VAR.
- Definition Classes
- CCodeGenerator → CCodeGenerator
-
def
translateActualParams(u: IdnUse, ps: Seq[Expression]): Seq[CExpression]
Translate the actual parameters of a procedure call.
Translate the actual parameters of a procedure call. Assumes that the right number of parameters are present.
- Definition Classes
- CCodeGenerator
-
def
translateFormalParam(m: Mode, i: String, t: Type): CDeclaration
Array formal parameters are not made into address types.
Array formal parameters are not made into address types.
- Definition Classes
- CCodeGenerator → CCodeGenerator
-
def
translateFormalParams(p: IdnDef): Seq[CDeclaration]
Translate the formal parameters of a particular defined procedure.
Translate the formal parameters of a particular defined procedure.
- Definition Classes
- CCodeGenerator
-
lazy val
trueConstant: IntegerValue
Built-in true constant.
Built-in true constant.
- Definition Classes
- SymbolTable
-
lazy val
typebasetype: (Type) ⇒ Type
The actual type that a user type denotes.
The actual type that a user type denotes.
- Definition Classes
- TypeAnalyser
-
lazy val
unknownType: BuiltinType
A type that is unknown, eg because the typed thing is erroneously defined.
A type that is unknown, eg because the typed thing is erroneously defined.
- Definition Classes
- SymbolTable
-
lazy val
value: (Expression) ⇒ Int
What is the value of an integer expression? Only needs to be valid if the expression is an integer constant (see isconst above) and is defined (eg, no divide by zero.) Returns zero in all other cases.
What is the value of an integer expression? Only needs to be valid if the expression is an integer constant (see isconst above) and is defined (eg, no divide by zero.) Returns zero in all other cases. FIXME: Ignores issues of overflow.
- Definition Classes
- NameAnalyser
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
lazy val
writeProc: BuiltinProc
The built-in Write procedure.
The built-in Write procedure.
- Definition Classes
- SymbolTable
-
lazy val
writelnProc: BuiltinProc
The built-in WriteLn procedure.
The built-in WriteLn procedure.
- Definition Classes
- SymbolTable