Skip to content

System Implementation

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

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

Table of Contents

The following pages contain more detailed information about the implementation of the current Source Modules system.

Introduction

Source Implementations 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

The two main methods of evaluating a Source program is through the js-slang interpreter and transpiler with the transpiler being the default mode. Read more about how the Source Modules system is integrated into the two modes in the js-slang page in this section.

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

Source Academy Frontend 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