{"id":14236006,"url":"https://github.com/SOSML/SOSML","last_synced_at":"2025-08-11T00:33:18.660Z","repository":{"id":24233539,"uuid":"96932703","full_name":"SOSML/SOSML","owner":"SOSML","description":" The Online Interpreter for Standard ML, written in TypeScript.","archived":false,"fork":false,"pushed_at":"2023-10-17T08:53:01.000Z","size":3927,"stargazers_count":177,"open_issues_count":8,"forks_count":9,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-08-08T22:40:03.690Z","etag":null,"topics":["interpreter","sml","typescript"],"latest_commit_sha":null,"homepage":"https://sosml.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SOSML.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-11T20:05:10.000Z","updated_at":"2025-08-08T20:34:41.000Z","dependencies_parsed_at":"2024-05-30T05:10:14.820Z","dependency_job_id":"99ab3125-c1df-4cbe-8c0c-7d04e5126ebc","html_url":"https://github.com/SOSML/SOSML","commit_stats":{"total_commits":991,"total_committers":14,"mean_commits":70.78571428571429,"dds":0.3874873864783047,"last_synced_commit":"a667fa4ad19b8528e4186cc3bb257b20524f06e4"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/SOSML/SOSML","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSML%2FSOSML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSML%2FSOSML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSML%2FSOSML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSML%2FSOSML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SOSML","download_url":"https://codeload.github.com/SOSML/SOSML/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSML%2FSOSML/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269663687,"owners_count":24455826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["interpreter","sml","typescript"],"created_at":"2024-08-20T21:02:40.112Z","updated_at":"2025-08-11T00:33:18.134Z","avatar_url":"https://github.com/SOSML.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# SOSML: The Online Interpreter for Standard ML\n\nSOSML is the online interpreter for the functional programming language Standard ML (SML), written in TypeScript.\nSOSML is used in a freshman class at Saarland University; you can check it out at https://sosml.org.\n\n## Features\nCorrectly lexing, parsing, elaborating and interpreting any SML core language program, i.e. a program that may contain the following constructs:\n\n* Supported declarations (_partially supported declarations in italics_)\n  * [x] value declarations (`val x = 42;`)\n  * [x] function declarations (`fun f 0 = 42 | f x = f (x-1);`)\n  * [x] type alias declarations (`type t = 'a -\u003e (int * int)`)\n  * [x] datatype declarations (`datatype tree = T of tree list;`)\n    * `withtype` will not be supported.\n  * [x] abstract datatype declarations (`abstype tree = T of tree list with val empty = T [];`)\n        Note that `abstype` is implemented as a derived form as proposed by Successor ML.\n    * `withtype` will not be supported.\n  * [x] exception declarations (`exception E of int;`)\n  * [x] local declarations (`local val x = 42; in val y = x + 2; end;`)\n  * [x] declaring operators as infix, nonfix, left, and right associative via `infix`, `infixr`, and `nonfix`\n  * [x] `open` declarations\n  * [x] structure declarations (`structure S = struct end;`)\n  * [x] signature declarations (`signature S = sig end;`)\n  * [x] functor declarations (experimental, `functor F = struct end;`)\n* Supported expressions (This list is non-exhaustive)\n  * [x] tuple (`(1, 2, 3)`), records (`{a = 1, b = 2}`), and lists (`[1, 2, 3]`)\n  * [x] application expressions (`f x`)\n  * [x] infix expressions (`3 + 4 - 5 * 6`)\n  * [x] `andalso` and `orelse` expressions\n  * [x] `raise` and `handle` expressions\n  * [x] conditionals (`if true then 2 else 3`)\n  * [x] case analyses (`case x of 0 =\u003e 0 | _ =\u003e 1`)\n  * [x] abstractions (`fn 0 =\u003e 0 | _ =\u003e 1`)\n  * [x] `while` loops\n  * [x] `print`\n  * [x] `ref`, `!`, and `:=`\n  * [x] structures\n  * [x] signatures\n  * [x] functors (experimental)\n* Supported standard library constructs (Note that all available libraries are loaded per default, currently SOSML has not implemented any user-space loading of modules.)\n  * Math library\n  * Char library `ord`, `chr`, `Char.isLower`, `Char.isUpper`, `Char.isDigit`, `Char.isAlpha`\n  * Int library `Int.minInt`, `Int.maxInt`, and `Int.compare`\n  * Real library `Real.compare`, `Real.fromInt`, `Real.round`, `Real.floor`, and `Real.ceil`\n  * Option library\n  * List and Listsort libraries\n  * Vector library `fromList`, `tabulate`, `length`, `sub`, `update`, `app`, `map`, `foldl`, `foldr`\n  * Array library `fromList`, `tabulate`, `length`, `sub`, `update`, `vector`, `foldl`, `foldr`\n  * String library\n\n## Using SOSML as an Interpreter for Standard ML (SML)\n\nIf you just want to test SOSML, just head to https://sosml.org/editor and enter your code.\nAdding a `;` will then start the evaluation.\n\nIf you don't like web browsers, but still want to test SOSML, you can install the experimental CLI via `npm`\n```bash\nnpm install -g @sosml/interpreter@latest\n```\nThis makes the command `sosml` available, which behaves like any other run-of-the-mill interpreter for SML.\nNote that due to its experimental state, the CLI currently does not take any options or parameters.\n\n## Using SOSML as a Component in Your Project\n\n### The `node` Way\n\nYou may use the interpreter bundled in SOSML or parts of it to build your own fancy SML interpreter:\nFirst, install SOSML via\n```bash\nnpm install --save @sosml/interpreter@latest\n```\nNow, to get your SML code interpreted by SOSML, import `interpret` and `getFirstState` from the package you just installed\nand you are good to go:\n```js\nimport { interpret, getFirstState, State } from '@sosml/interpreter';\n\n// Obtain an initial state for the interpretation\nlet initialState: State = getFirstState();\n\n// Let's interpret some code\nlet interpretationResult = interpret('val x = \"Hello World!\";', initialState);\nconsole.log(interpretationResult.state.toString({stopId: initialState.id + 1})); // Prints \"val x = \"Hello World!\": string;\"\n\n// Let's interpret some more code; note how we use the state obtained from the last step\ninterpretationResult = interpret('fun f y = x | f 10 = \"???\";', interpretationResult.state);\n\n// Note that the last code produced a warning:\nconsole.log(interpretationResult.warnings); // Something like \"Rules after \"y\" unused in pattern matching.\"\n\n// Similarly, interpretationResult.evaluationErrored may contain an Error if the interpretation of your code failed\n// Lastly, SML exceptions raised by your code that are not handled end up in interpretationResult.error.\n```\nCheck out the `src/cli.ts` file for an example SML interpreter using SOSML.\n\n### The “But I Hate `node.js`” Way\n\nStarting with version `1.5.0`, you can directly run SOSML in a `\u003cscript\u003e` tag in HTML:\n\n```HTML\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003cmeta charset=\"utf-8\"\u003e\n        \u003cscript src=\"https://unpkg.com/@sosml/interpreter@^1.5.0/build/interpreter.min.js\"\u003e\u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003cscript\u003e\n            let initialState = Interpreter.getFirstState();\n            let interpretationResult = Interpreter.interpret('val x = \"Hello World!\";', initialState);\n            console.log(interpretationResult.state.toString({stopId: initialState.id + 1}));\n            interpretationResult = Interpreter.interpret('fun f y = x | f 10 = \"???\";', interpretationResult.state);\n            console.log(interpretationResult.warnings);\n        \u003c/script\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Contributing to SOSML\n\nWe welcome you to open an Issue for any error or squid you may find, and we will try to fix it ASAP.\nFurther, if you want additional parts of the Standard Library or other features in general implemented,\nfeel free to open a new Issue.\n\nIf you want to contribute via writing code, you may check the Issues page for any unresolved problems\nor unimplemented features and then submit a pull request after solving that problem or implementing that feature.\n\n### Cloning and Building\n\nTo get started on writing code for SOSML, clone the repository and install the dependencies:\n```bash\ngit clone https://github.com/SOSML/SOSML\nnpm install\n```\n\nTo build the interpreter and pack it into one file using [Webpack](https://webpack.js.org/) run:\n```bash\nnpm run build\n```\nThis will create a file in the directory `build` called `interpreter.js`.\n\nTo also minify the result run:\n```bash\nnpm run dist\n```\nThis will create a file in the directory `build` called `interpreter.min.js`.\n\nTo build the CLI, run\n```bash\nnpm run cli\nnpm link\n```\n\n### Testing Your Changes\n\nSOSML comes with an extensive set of tests which can be run via\n```bash\nnpm test\n```\nThis runs all tests located in the `test` directory.\nWhen contributing new code, please make sure that you add the appropriate tests and that no old tests begin to fail.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSOSML%2FSOSML","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSOSML%2FSOSML","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSOSML%2FSOSML/lists"}