Giter Site home page Giter Site logo

aurelsoc / js-slang Goto Github PK

View Code? Open in Web Editor NEW

This project forked from source-academy/js-slang

0.0 0.0 0.0 2.89 MB

Implementations of the Source languages (TypeScript)

Home Page: https://sourceacademy.nus.edu.sg

License: Apache License 2.0

TypeScript 98.83% Shell 1.17%

js-slang's Introduction

js-slang

https://travis-ci.org/source-academy/js-slang.svg?branch=master https://coveralls.io/repos/github/source-academy/js-slang/badge.svg?branch=master

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://sicp.comp.nus.edu.sg).

Usage

To run in native, set isNativeRunnable to true here: https://github.com/source-academy/js-slang/blob/master/src/index.ts#L29

To build,

$ git clone https://github.com/source-academy/js-slang.git
$ cd js-slang
$ yarn
$ yarn build

To try out Source in a REPL, run

$ node dist/repl/repl.js [chapter] # default: 1

or alternatively, install js-slang and run

$ npm -g install js-slang   # Install js-slang
$ js-slang [chapter] # default: 1

Documentation

Source is documented here: https://sicp.comp.nus.edu.sg/source/

To build the documentation, run

$ git clone https://github.com/source-academy/js-slang.git
$ cd js-slang
$ npm install # If additional permissions are required, run sudo npm install
$ make           # to make the PDF documents using LaTeX
$ yarn run jsdoc # to make the web pages in js-slang/doc/source

Error messages

To enable verbose messages, have the statement "enable verbose"; as the first line of your code.

There are two main kinds of error messages: those that occur at runtime and those that occur at parse time. The first can be found in interpreter-errors.ts, while the second can be found in rules/.

Each error subclass will have explain() and elaborate(). Displaying the error will always cause the first to be called; the second is only called when verbose mode is enabled. As such, explain() should be made to return a string containing the most basic information about what the error entails. Any additional details about the error message, including specifics and correction guides, should be left to elaborate().

Please remember to write test cases to reflect your added functionalities. The god of this repository is self-professed to be very particular about test cases.

Documentation

Documentation on Source §x is generated from LaTeX sources in folder doc. Currently the documents are generated as follows: `` cd doc; make ``

Documentation on the Source libraries are generated from inline documentation in the library sources. The libraries are in repository cadet-frontend, which is assumed to be located in ../cadet-frontend, from the root of this repo. The documentation is generated as follows: `` yarn run jsdoc `` This command makes the documentation available in folder `` doc/jsdoc/libraries/ ``

js-slang's People

Contributors

ning-y avatar openorclose avatar martin-henz avatar remo5000 avatar thomastanck avatar dependabot[bot] avatar dependabot-preview[bot] avatar yyc avatar leowwb avatar swampertx avatar podocarp avatar jiachen247 avatar geshuming avatar urieltan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.