#interpreter #csp #ap #web #cut #rough #web-interface

bin+lib pseudocode

AP CSP Pseudocode interpreter (rough cut)

9 releases

0.1.8 Mar 19, 2021
0.1.7 Jun 23, 2020
0.1.4 Apr 14, 2020
0.1.2 Mar 30, 2020

#535 in Programming languages

Custom license

47KB
1K SLoC

Rust 1K SLoC // 0.0% comments Pest 113 SLoC

AP Pseudocode Interpreter

Includes:

  • Rust library
  • Command line interface
  • Web interface

Building

Web Interface

Need installed: cargo, rust, npm

  1. Install wasm-pack
  2. Install cargo-generate:
    cargo install cargo-generate
    
  3. Initialize javascript setup from inside web/www
    cd web/www
    # if doing for first time
    #npm init wasm-app www
    
    cd www
    npm install
    
  4. Run with
    npm run start
    

Serving Statically

It is possible to build this so that you can serve all the file statically. First, run npm run build to put the files in web/www/dist, then serve the dist directory. Make sure that your webserver (e.g. nginx) is attaching the application/wasm MIME type for the .wasm resources. You can enforce this in nginx by adding the following line to /etc/nginx/mime.types:

    application/wasm    wasm

TODO

  • list:
    • need to implement lists as a reference type
    • rather than embedding the backing Vec inside the Value enum, embed a reference to the Vec that is stored in a Scope environment
    • this would require expanding the Scope nevironment to hold references, likely in a separate dictionary?
  • negative numbers
  • negation
  • NOT
  • native functions: implement in Rust
    • CONCAT
    • SUBSTRING
    • RANDOM
    • [ ] DISPLAY (?)
  • robot stuff
  • stepped execution

Dependencies

~3.5MB
~68K SLoC