Evaluating Kiama abstract state machines for a Java implementation
thesisposted on 2022-03-29, 02:35 authored by Pongsak Suvanpong
This thesis represents nine months of research in the area of embedded domain-specific programming languages. Kiama is a pure embedded lightweight language processing library in Scala. It provides classes for language processing paradigms such as attribute grammars, strategic term rewriting and abstract state machines (ASM) which can be used for analyzing, translating and executing languages. In this thesis, we evaluate the ASM component of Kiama by implementing several complex machines for executing the dynamic semantics of the Java language and the Java Virtual Machine byte code into which it is translated. We use the book “Java and the Java Virtual Machine: Definition, Verification and Validation” by R. Stärk, J. Schmid and E. Börger, as our reference. The book describes the Java language version 1.2 using the ASM method. We are able to implement the machines without any modifications to Kiama's ASM. The combination of Scala and Kiama allows us to closely replicate the book’s ASM notations in executable code. However, we find a few problems with the Kiama ASM library for which we show workarounds. In addition, we discover a few bugs in the book's machine definitions and provide fixes in our implementation.