Abstract machine for formal semantics of SIMP (Simple Imperative Language)

Overview

SIMP-abstract-machine

In 2020/21 I was a Teaching Assistant for the second year module 5CCS2PLD Programming Language Paradigms at King's College London. PLD deals with formal semantics and verification of programming languages.

For exploring semantics, the module textbook (Programming Languages and Operational Semantics) defines an educational language SIMP (the Simple Imperative Language), for which an abstract syntax and abstract machine semantics are given.

This project is a Java implementation of the SIMP abstract machine used to teach students about formal reasoning of SIMP programs.

Abstract syntax

The following is a concise overview of the abstract syntax of SIMP. This syntax is represented as classes and enums in the command, integer, and bool packages.
Abstract syntax of SIMP

Abstract machine

An abstract machine interprets an abstract syntax tree of a SIMP program and follows a transition system to evaluate the programs.

Configuration

The abstract machine is defined as a tuple (c, r, m), called a configuration, where

  • c is a control stack used to store the program and determines which transitions to follow
  • r is an auxiliary stack (also called results stack) that stores intermediary results
  • m is memory, also called a store, modelled by a partial function mapping each string addresses to memory. Memory is used to store variables and acts as I/O to the program.

The control stack (c) and result stack (r) can each hold fixed data types: Control and result stacks
These types are represented in Java using the ControlStackable and ResultsStackable interfaces. Note that (a β€’ b) indicates a stack where a is on top of b.

Transitions

To simulate a SIMP program, a set of transition rules are defined. These determine how the abstract machine changes configurations based on what is at the top of the control stack. Expression transiions
Commmand transiions
These transitions are implemented in the Evaluator class.

Usage

To run a SIMP program, it must be represented as an abstract syntax tree and passed to the Evaluator class as a constructor argument.

An example program that calculates x^n can be found in the Main class.

Further information

Additional information about SIMP can be found in Maribel Fernandez's textbook Programming Languages and Operational Semantics

You might also like...

statistics, data mining and machine learning toolbox

statistics, data mining and machine learning toolbox

Disambiguation (Italian dictionary) Field of turnips. It is also a place where there is confusion, where tricks and sims are plotted. (Computer scienc

Jun 11, 2022

Oryx 2: Lambda architecture on Apache Spark, Apache Kafka for real-time large scale machine learning

Oryx 2: Lambda architecture on Apache Spark, Apache Kafka for real-time large scale machine learning

Oryx 2 is a realization of the lambda architecture built on Apache Spark and Apache Kafka, but with specialization for real-time large scale machine l

Mar 12, 2021

πŸ’» Machine Coding - leetcode LLD (coding blox) - It is an Online Coding Platform that allows a user to Sign Up, Create Contests and participate in Contests hosted by Others.

leetcode-lld-flipkart-coding-blox Machine coding - leetcode LLD (coding blox) My Approach : https://leetcode.com/discuss/interview-question/object-ori

Sep 15, 2022

jMonkeyEngine Animation State Machine

jme-anim-state-machine jMonkeyEngine Animation State Machine State machine to make animation states consume from a character controller state. This wa

Oct 20, 2021

Tribuo - A Java machine learning library

Tribuo - A Java machine learning library

Tribuo - A Java prediction library (v4.2) Tribuo is a machine learning library in Java that provides multi-class classification, regression, clusterin

Dec 28, 2022

Java time series machine learning tools in a Weka compatible toolkit

UEA Time Series Classification A Weka-compatible Java toolbox for time series classification, clustering and transformation. For the python sklearn-co

Nov 7, 2022

πŸ‘¨β€πŸ«ITMO University first 4 labs. They are about object oriented programming and Java language

Java-Programming-1st-semester 1st lab - math operations, formatted output. 2nd lab - object oriented programming. 3rd lab - SOLID and STUPID principle

Dec 1, 2022

πŸ‘„ The most accurate natural language detection library for Java and the JVM, suitable for long and short text alike

πŸ‘„ The most accurate natural language detection library for Java and the JVM, suitable for long and short text alike

Quick Info this library tries to solve language detection of very short words and phrases, even shorter than tweets makes use of both statistical and

Dec 28, 2022
Owner
Sten Arthur Laane
Sten Arthur Laane
Datumbox is an open-source Machine Learning framework written in Java which allows the rapid development of Machine Learning and Statistical applications.

Datumbox Machine Learning Framework The Datumbox Machine Learning Framework is an open-source framework written in Java which allows the rapid develop

Vasilis Vryniotis 1.1k Dec 9, 2022
This repository holds the famous Data Structures (mostly abstract ones) and Algorithms for sorting, traversing, and modifying them.

Data-Structures-and-Algorithms About Repo The repo contains the algorithms for manipulating the abstract data structures like Linked List, Stacks, Que

Zaid Ahmed 14 Dec 26, 2021
MALLET is a Java-based package for statistical natural language processing, document classification, clustering, topic modeling, information extraction, and other machine learning applications to text.

MALLET is a Java-based package for statistical natural language processing, document classification, clustering, topic modeling, information extraction, and other machine learning applications to text.

null 900 Jan 2, 2023
Simple ATM Machine made with Java

Output / Preview Enter your account number: Enter your pin number: ATM main menu: 1. - View Account Balance 2. - Withdraw funds 3. - Add funds 4. - T

SonLyte 10 Oct 21, 2021
Java Statistical Analysis Tool, a Java library for Machine Learning

Java Statistical Analysis Tool JSAT is a library for quickly getting started with Machine Learning problems. It is developed in my free time, and made

null 752 Dec 20, 2022
Oryx 2: Lambda architecture on Apache Spark, Apache Kafka for real-time large scale machine learning

Oryx 2 is a realization of the lambda architecture built on Apache Spark and Apache Kafka, but with specialization for real-time large scale machine l

Oryx Project 1.8k Dec 28, 2022
Statistical Machine Intelligence & Learning Engine

Smile Smile (Statistical Machine Intelligence and Learning Engine) is a fast and comprehensive machine learning, NLP, linear algebra, graph, interpola

Haifeng Li 5.7k Jan 1, 2023
A machine learning package built for humans.

aerosolve Machine learning for humans. What is it? A machine learning library designed from the ground up to be human friendly. It is different from o

Airbnb 4.8k Dec 30, 2022