Go in Source Academy

Source Academy is an online experiential environment for computational thinking. It provides extensive support for the programming language JavaScript, including an interactive textbook “Structure and Interpretation of Computer Programs” (SICP) that is adapted to JavaScript. It contains various sub-languages and variants implemented with transpilers, compilers, and interpreters. It is currently used for the course CS1101S, which is an elementary programming course in the National University of Singapore, School of Computing, where it uses different variants of sub-languages of JavaScript, also known as Source, as the course progresses. This project aims to bring the language "Go" into the Source Academy.

Poster image to be added

Description

The existing system uses the Virtual Machine framework where the program which is written in Go is parsed into an Abstract Syntax Tree (AST) by PeggyJS, which is then compiled into Virtual Machine (VM) Instructions, then the executor will execute these instructions to run the program.

In the current project, the following features are supported in addition to the existing system:

  • Functions returning multiple values at once
  • Structs
  • Pointers

Some enhancements to the existing system include:

  • Fixing arrays being passed into functions to be immutable (mutation only on the copy of the array)
  • Memory layout of arrays to be contiguous
  • Goroutines using the copy of the variables instead of the actual variable in the caller function

Project Members