Theory Language
theory Language imports AssocLists begin
section‹Language \label{sec:language}›
subsection‹Syntax›
text‹We have syntactic classes of (local) variables, class names,
field names, and method names. Naming restrictions, namespaces, long
Java names etc.~are not modelled.›
typedecl Var
typedecl Class
typedecl Field
typedecl Method
text‹Since arithmetic operations are modelled as unimplemented
functions, we introduce the type of values in this section. The domain
of heap locations is arbitrary.›
typedecl Addr
text‹A reference is either null or an address.›
datatype Ref = Nullref | Loc Addr
text‹Values are either integer numbers or references.›
datatype Val = RVal Ref | IVal int
text‹The type of (instruction) labels is fixed, since the operational
semantics increments the program counter after each instruction.›
type_synonym Label = int
text‹Regarding the instructions, we support basic operand-stack
manipulations, object creation, field modifications, casts, static
method invocations, conditional and unconditional jumps, and a return
instruction.
For every (Isabelle) function ‹f : Val⇒Val⇒Val› we have an
instruction ‹binop f› whose semantics is to invoke ‹f›
on the two topmost values on the operand stack and replace them with
the result. Similarly for ‹unop f›.›