Skip to content

NeuralCoder3/SOOCaml-frontend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

OCaml Version of SOSML

Note: The website with server backing is http://89.58.5.223/ (v2202201167307177506.ultrasrv.de).

The goal is to update SOSML to support OCaml.

There are multiple ways to do this:

  • Extension:
    • Write a OCaml -> SML transpiler for parsing
    • Write a postprocessor for the SML output
  • A new interpreter
    • Use an OCaml interpreter instead of the SML interpreter
    • We are closer to the OCaml semantics
    • No need to worry about the differences between SML and OCaml
    • No transpiler or SML adaptation needed
    • We have less control
    • We have no full roll-back partial evaluation of code blocks (possible via tricks or toplevel adaptation)
    • The OCaml toplevel can be compiled to Javascript using the [js_of_ocaml]http://ocsigen.org/js_of_ocaml/latest/manual/overview) project (Github)
      • A toplevel example can be found here
      • The current interpreter TryOCaml (Github) also uses this project
      • A standalone toplevel is easy to obtain (see example here)
    • The cleaner way
      • Wrap the toplevel in a way that exposes functions that the SML interpreter uses
      • Rewrite the worker to use the (wrapped) OCaml toplevel
      • Use the worker in the frontend (here) (no adaptation required)
    • The easier way:
      • Just ignore the interpreter and worker
      • Force the editor to execute its code via the evaluator (transpiled OCaml toplevel)

Differences OCaml and SML:

Links:

Information about the SOSML projects:

  • The core project SOSML contains the SML logic and the interpreter
  • The webworker wrappes the interpreter and exposes it as javascript file that can be included in other projects
  • The frontend uses the worker in the editor component

Note: The npm commands might need export NODE_OPTIONS=--openssl-legacy-provider.

Special Features

  • StdOut that contains a ppm image is automatically displayed.
    • PPM Images need to start with "P3\n[remaining]" or "IMAGE\n[PPM content]"
    • Magenta (1.0,0.0,1.0) is rendered as transparent
  • Shared Libraries like Image with eval_image ?(wh=(256,256)) name img : () are automatically included.

SOSML - Frontend

A frontend for SOSML, used by sosml.org, that has different themes (with dark mode support) and allows for saving SML code in the browser.

Installation Instructions

Prerequisites

Node.JS version 8 or higher and NPM version 5 or higher need to be installed on the system. GNU+Linux is recommended.

git clone https://github.com/NeuralCoder3/SOOCaml-frontend.git

Install/Update all NPM dependencies

To install or(non-exclusive or) update all NPM dependencies run npm i in the frontend folder.

Building and Running frontend

The frontend can be run locally with npm run start, this will use a compiled version of the webworker placed in the frontend/public server to actually run SML code. To obtain optimized files suitable for production, use npm run build to populate tho build folder. The files in the build folder are then suitable to be served on a static web server. (Consult the SOSML-backend repository on how to run a non-static server that allows for file uploading/sharing.)

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 85.7%
  • CSS 7.6%
  • JavaScript 5.8%
  • HTML 0.9%