Skip to content

System Implementation

Bryan Loh edited this page Apr 18, 2021 · 20 revisions

The following group of pages will document about the implementation of the current Source Modules system.

Introduction

js-slang

The js-slang library contains the open-source implementations of the programming language Source. Source is a series of small subsets of JavaScript, designed for teaching university-level programming courses for computer science majors, following Structure and Interpretation of Computer Programs, JavaScript Adaptation (https://source-academy.github.io/sicp/).

The js-slang library exposes one main function that Source Modules system developers should be concerned with, the runInContext method.

runInContext(code: string, context: Context, options: Partial<IOptions> = {}): Promise<Result> { ... }

Applying this funciton on a Source program string will trigger the evaluation of the provided Source program string. The object returned from runInContext is of Result type that contains the value which is the result of the last statement in the evaluation of the Source program string. Below is a brief overview of the evaluation process of the runInContext function exposed by the Source implementation library.

js-slang runInContext flow

Read more about the js-slang Source implementation library here.

cadet-frontend

The cadet-frontend project contains information regarding the frontend of the Source Academy (https://source-academy.github.io/) immersive online experiential environment for learning programming, developed in the School of Computing at the National University of Singapore. This repository houses the sources for the frontend of the Source Academy, written in ReactJS with Redux.

Read more about cadet-frontend the frontend of Source Academy here.

Clone this wiki locally