-
Notifications
You must be signed in to change notification settings - Fork 29
Overview
This page contains information regarding the overview of the Source Modules system.
- Decouple Source modules from the frontend and backend of Source Academy, as well as the implementation of Source language, enhancing the flexibility of Source modules.
- Optionally render interactive user interfaces for students to use with Source Academy to enhance their learning experience.
- Allow ease of collaboration and promotes contribution to the modules ecosystem without a steep learning curve.
The project was suggested by Prof Martin Henz who first proposed to include import statements in the Source Language in the js-slang
issue here. This move aims to achieve 3 main things:
- To demystify module loading for students. Source would be in line with other programming languages where imported functionality is explicitly named in programs.
- To simplify the Source Academy user interface. There will no longer be a need for a “library” menu.
- To simplify Source implementation tools. Imported names will all be explicitly mentioned in the Source program.
I'm proposing to allow the following syntax in Source:
program ::= importdirective... statement... importdirective ::= import { importnames } from string; importnames ::= importname (, importname)... importname ::= name | name as name
This means that we will explicitly import modules (libraries) from now on, in order to use them:
import { heart as lung, show as view, stack, sail } from 'lib/runes'; view(stack(lung, sail));
For Source 2021, the path will be resolved to: https://github.com/source-academy/modules/tree/master/ This means that
from 'lib/runes'
refers to https://github.com/source-academy/modules/tree/master/lib/runes.js (the default file extension will be.js
)The Source Academy frontend will fetch the module from the backend, which of course will cache it. Our modules can still be written in JavaScript and loaded in the frontend in whatever way works (e.g.
eval
).In the future, we can allow for a more flexible scheme where users can import Source programs using the same syntax.
- Home
- Overview
- System Implementation
-
Development Guide
- Getting Started
- Repository Structure
-
Creating a New Module
- Creating a Bundle
- Creating a Tab
- Writing Documentation
- Developer Documentation (TODO)
- Build System
- Source Modules
- FAQs
Try out Source Academy here.
Check out the Source Modules generated API documentation here.