{"id":44049921,"url":"https://github.com/magnusopera/fscript","last_synced_at":"2026-04-02T23:58:57.819Z","repository":{"id":337101224,"uuid":"1151601799","full_name":"MagnusOpera/FScript","owner":"MagnusOpera","description":"Functional language interpreter - F#/ML inspired","archived":false,"fork":false,"pushed_at":"2026-02-10T22:55:47.000Z","size":503,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-11T00:28:54.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MagnusOpera.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":"docs/supported-types.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-06T17:07:39.000Z","updated_at":"2026-02-10T22:55:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/MagnusOpera/FScript","commit_stats":null,"previous_names":["magnusopera/fscript"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/MagnusOpera/FScript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FFScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FFScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FFScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FFScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MagnusOpera","download_url":"https://codeload.github.com/MagnusOpera/FScript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FFScript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29350079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T20:11:40.865Z","status":"ssl_error","status_checked_at":"2026-02-11T20:10:41.637Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-07T23:07:30.859Z","updated_at":"2026-04-02T23:58:57.812Z","avatar_url":"https://github.com/MagnusOpera.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![FScript logo](https://raw.githubusercontent.com/MagnusOpera/FScript/refs/heads/main/FScript.png)\n\n# FScript\n[![Build (main)](https://github.com/MagnusOpera/FScript/actions/workflows/ci-main.yml/badge.svg?branch=main)](https://github.com/MagnusOpera/FScript/actions/workflows/ci-main.yml)\n[![NuGet Language](https://img.shields.io/nuget/v/MagnusOpera.FScript.Language?label=NuGet%20Language)](https://www.nuget.org/packages/MagnusOpera.FScript.Language)\n[![NuGet Runtime](https://img.shields.io/nuget/v/MagnusOpera.FScript.Runtime?label=NuGet%20Runtime)](https://www.nuget.org/packages/MagnusOpera.FScript.Runtime)\n\nFScript is a lightweight, embeddable interpreter with an F#/ML-style language.\n\nIt is designed for host applications that need:\n- a concise functional scripting language,\n- strong static checks (Hindley-Milner type inference),\n- controlled host extensibility,\n- and a clear sandbox/security boundary.\n\n## Why FScript\n\n- **F#/ML lineage**: immutable data, expressions-first style, pattern matching, `let`/`fun`, algebraic modeling.\n- **Interpreter pipeline**: lexer -\u003e parser -\u003e type inference -\u003e evaluator.\n- **Host-first extensibility**: add external functions with explicit type schemes and runtime implementations.\n- **Security-aware embedding**: script capabilities are defined by what the host exposes.\n\n## Language Snapshot\n\nFScript currently includes:\n- bindings and functions: `let`, `let rec`, `and` mutual recursion, lambdas,\n- control flow: `if/elif/else`, `match`, `for ... in ... do`,\n- data: list, option, tuple, map, record, discriminated unions,\n- pattern matching: list, option, tuple, record, union cases,\n- optional type annotations on parameters,\n- type declarations: records and unions (including recursive forms),\n- interpolation, pipeline operator, `typeof` type tokens, and `nameof` identifier tokens for host workflows.\n- unified brace literals for records/maps (`{ Field = value }`, `{ [key] = value }`, `{}` for empty map), with map keys typed as `string`.\n\n## Getting Started Tutorial\n\nIf you are new to FScript, start with the progressive tutorial:\n\n- [`docs/guides/getting-started-tutorial.md`](docs/guides/getting-started-tutorial.md)\n\nIt covers installation, syntax basics, flow control, collections, pattern matching, stdlib usage, includes, and host/export concepts.\n\n## Installation\n\n### CLI via Homebrew\n```bash\nbrew install magnusopera/tap/fscript\n```\n\n### Embeddable language via NuGet\n- `MagnusOpera.FScript.Language`\n- `MagnusOpera.FScript.Runtime`\n\n## VS Code Extension\n\nFScript has a first-party VS Code extension with syntax highlighting and Language Server features (diagnostics, completion, hover, symbols, go-to-definition, references, rename, semantic tokens, inlay hints).\n\n- VS Code Marketplace: `https://marketplace.visualstudio.com/items?itemName=MagnusOpera.fscript`\n- Open VSX: `https://open-vsx.org/extension/MagnusOpera/fscript`\n\nThe extension uses automatic .NET runtime acquisition via `.NET Install Tool` and falls back to `dotnet` from `PATH` when needed.\nSource lives in [`vscode-fscript/`](vscode-fscript/).\n\n## Repository Development\n\n### Build\n```bash\nmake build\n```\n\n### Test\n```bash\nmake test\n```\n\n### Run a script\n```bash\ndotnet run --project src/FScript -- samples/types-showcase.fss\n```\n\nRun a script with script arguments (after `--`):\n```bash\ndotnet run --project src/FScript -- samples/fibonacci.fss -- 10\n```\n\nOptional sandbox root override:\n```bash\ndotnet run --project src/FScript -- --root /tmp/sandbox samples/types-showcase.fss\n```\n\nDisable default runtime externs (`Registry.all`):\n```bash\ndotnet run --project src/FScript -- --no-default-externs samples/types-showcase.fss\n```\n\nLoad user extern providers from an assembly (repeatable):\n```bash\ndotnet run --project src/FScript -- --extern-assembly ./MyExterns.dll samples/types-showcase.fss\n```\n\nRun a script from stdin:\n```bash\ncat samples/types-showcase.fss | dotnet run --project src/FScript -- -r .\n```\n\nRun stdin mode with script arguments:\n```bash\ncat samples/types-showcase.fss | dotnet run --project src/FScript -- -r . -- foo bar\n```\n\nShow CLI version:\n```bash\ndotnet run --project src/FScript -- version\n```\n\nIn CLI execution modes, scripts get:\n- stdlib `type Environment = { ScriptName: string option; Arguments: string list }`\n- CLI-injected `let Env = ...`\n\nStart REPL:\n```bash\ndotnet run --project src/FScript --\n```\n\nUseful samples:\n- [`samples/types-showcase.fss`](samples/types-showcase.fss)\n- [`samples/patterns-and-collections.fss`](samples/patterns-and-collections.fss)\n- [`samples/quicksort.fss`](samples/quicksort.fss)\n- [`samples/tree.fss`](samples/tree.fss)\n- [`samples/mutual-recursion.fss`](samples/mutual-recursion.fss)\n- [`samples/imports-and-exports.fss`](samples/imports-and-exports.fss)\n\n## Interpreter Architecture\n\nThe core engine lives in `src/FScript.Language` and runs in four stages:\n1. **Lexing**: indentation-aware tokenization.\n2. **Parsing**: AST construction with expression/layout rules.\n3. **Type inference**: Hindley-Milner inference + unification + optional annotations.\n4. **Evaluation**: typed AST evaluation with immutable values and pattern matching.\n\nHost integration lives in `src/FScript.Runtime`.\n\n## Extensibility Model\n\nFScript is extended through host-provided externs.\n\nEach extern declares:\n- a public name (for script calls),\n- a type scheme,\n- arity,\n- implementation.\n\nBuilt-in host extern families include `Fs.*`, `Json.*`, `Xml.*`, `Regex.*`, hashing, GUIDs, and `print`.\n`List.*`, `Map.*`, and `Option.*` are provided by the embedded stdlib prelude.\n\nFor details and extension workflow, see [`docs/specs/external-functions.md`](docs/specs/external-functions.md).\n\n## Sandbox and Security\n\nFScript runs in-process. Security is capability-based:\n- scripts can only do what exposed externs allow,\n- core language evaluation is deterministic over in-memory values,\n- side effects and external I/O are controlled at host extern boundaries.\n\nOperational controls (timeouts, cancellation, resource limits, process/container isolation) are host responsibilities.\n\nSee [`docs/specs/sandbox-and-security.md`](docs/specs/sandbox-and-security.md) for the full model and checklist.\n\n## Documentation\n\n- Documentation website: `https://magnusopera.github.io/FScript/`\n- Documentation portal: [`docs/README.md`](docs/README.md)\n- Tutorial: [`docs/guides/getting-started-tutorial.md`](docs/guides/getting-started-tutorial.md)\n- Specifications index: [`docs/specs/README.md`](docs/specs/README.md)\n- Architecture index: [`docs/architecture/README.md`](docs/architecture/README.md)\n- FScript vs F# / OCaml: [`docs/guides/fsharp-ocaml-differences.md`](docs/guides/fsharp-ocaml-differences.md)\n\nWebsite development commands:\n\n```bash\nmake website-install\nmake website-build\nmake website-serve\nmake website-version version=X.Y.Z\n```\n\n## Changelog\n\n- [`CHANGELOG.md`](CHANGELOG.md)\n\n## License\n\nThis project is licensed under the MIT License.  \nSee [`LICENSE`](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnusopera%2Ffscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagnusopera%2Ffscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnusopera%2Ffscript/lists"}