Coder Social home page Coder Social logo

yiransheng / basic_rs Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 3.0 557 KB

Original Dartmouth BASIC Interpreter/Compiler

Visual Basic 6.04% Rust 85.33% JavaScript 4.34% Python 0.20% WebAssembly 2.98% HTML 0.98% Shell 0.14%
basic compiler interpreter relooper rust vm wasm web-assembly

basic_rs's People

Contributors

yiransheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

basic_rs's Issues

Fully implement insignificant spaces in Scanner

Currently, scanner is somewhat spaces insensitive, it can recognize tokens like "L E T".

However, certain cases are not covered, such as "< =".

Do a full audit, and make sure spaces are skipped when needed, and add unit tests for all token types.

Newtype on LineNo

Currently LineNo is a type alias to usize.

Should convert it to a new type, as in a couple of places line numbers might get confused with line index.

Add support for INPUT

This will allow interactive programs.

Supporting it in wasm will be tricky, as INPUT is blocking.. maybe use window.confirm for this?

Changes required:

  • Update keyword.js to generate new type and compile time DFA for keywords
  • Update Token enum
  • Update ast data types with new statement type
  • Update parser
  • Add Statement::Input variant in ir
  • Add Input OpCode variant
  • Modify VM to take in stdin.lock() in run and exec method
  • Handle stdin input, fail on number parsing (add new variant to RuntimeError)
  • Use unimplemented!() on wasm side

Later,

Investigate window.confirm approach

EDIT: window.prompt

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.