MagnusOpera.FScript.Language
0.1.3
Prefix Reserved
See the version list below for details.
dotnet add package MagnusOpera.FScript.Language --version 0.1.3
NuGet\Install-Package MagnusOpera.FScript.Language -Version 0.1.3
<PackageReference Include="MagnusOpera.FScript.Language" Version="0.1.3" />
<PackageVersion Include="MagnusOpera.FScript.Language" Version="0.1.3" />
<PackageReference Include="MagnusOpera.FScript.Language" />
paket add MagnusOpera.FScript.Language --version 0.1.3
#r "nuget: MagnusOpera.FScript.Language, 0.1.3"
#:package MagnusOpera.FScript.Language@0.1.3
#addin nuget:?package=MagnusOpera.FScript.Language&version=0.1.3
#tool nuget:?package=MagnusOpera.FScript.Language&version=0.1.3
FScript
FScript is a lightweight, embeddable interpreter with an F#/ML-style language.
It is designed for host applications that need:
- a concise functional scripting language,
- strong static checks (Hindley-Milner type inference),
- controlled host extensibility,
- and a clear sandbox/security boundary.
Why FScript
- F#/ML lineage: immutable data, expressions-first style, pattern matching,
let/fun, algebraic modeling. - Interpreter pipeline: lexer → parser → type inference → evaluator.
- Host-first extensibility: add external functions with explicit type schemes and runtime implementations.
- Security-aware embedding: script capabilities are defined by what the host exposes.
Language Snapshot
FScript currently includes:
- bindings and functions:
let,let rec,andmutual recursion, lambdas, - control flow:
if/elif/else,match,for ... in ... do, - data: list, option, tuple, map, record, discriminated unions,
- pattern matching: list, option, tuple, record, union cases,
- optional type annotations on parameters,
- type declarations: records and unions (including recursive forms),
- interpolation, pipeline operator, and
typeoftype tokens for host workflows.
Quick Start
Build
make build
Test
make test
Run a script
dotnet run --project src/FScript -- samples/types-showcase.fss
Optional sandbox root override:
dotnet run --project src/FScript -- --root /tmp/sandbox samples/types-showcase.fss
Useful samples:
samples/types-showcase.fsssamples/patterns-and-collections.fsssamples/tree.fsssamples/mutual-recursion.fss
Distribution
Homebrew
brew tap magnusopera/tap
brew install fscript
NuGet
MagnusOpera.FScript.LanguageMagnusOpera.FScript.Runtime
Interpreter Architecture
The core engine lives in src/FScript.Language and runs in four stages:
- Lexing: indentation-aware tokenization.
- Parsing: AST construction with expression/layout rules.
- Type inference: Hindley-Milner inference + unification + optional annotations.
- Evaluation: typed AST evaluation with immutable values and pattern matching.
Host integration lives in src/FScript.Runtime.
Extensibility Model
FScript is extended through host-provided externs.
Each extern declares:
- a public name (for script calls),
- a type scheme,
- arity,
- implementation.
Built-in extern families include List.*, Map.*, Option.*, Fs.*, Json.*, Xml.*, Regex.*, hashing, GUIDs, and print.
For details and extension workflow, see docs/external-functions.md.
Sandbox and Security
FScript runs in-process. Security is capability-based:
- scripts can only do what exposed externs allow,
- core language evaluation is deterministic over in-memory values,
- side effects and external I/O are controlled at host extern boundaries.
Operational controls (timeouts, cancellation, resource limits, process/container isolation) are host responsibilities.
See docs/sandbox-and-security.md for the full model and checklist.
Documentation
docs/syntax-and-indentation.mddocs/supported-types.mddocs/function-annotations.mddocs/external-functions.mddocs/sandbox-and-security.mddocs/fsharp-ocaml-differences.mddocs/assemblies-and-roles.md
License
This project is licensed under the MIT License.
See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FSharp.Core (>= 10.0.102)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MagnusOpera.FScript.Language:
| Package | Downloads |
|---|---|
|
MagnusOpera.FScript.Runtime
Runtime externs and host integration layer for FScript. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.12.0 | 0 | 2/9/2026 |
| 0.11.0 | 5 | 2/8/2026 |
| 0.10.0 | 11 | 2/8/2026 |
| 0.9.0 | 20 | 2/8/2026 |
| 0.8.0 | 20 | 2/8/2026 |
| 0.7.0 | 24 | 2/8/2026 |
| 0.5.0 | 27 | 2/8/2026 |
| 0.4.0 | 29 | 2/8/2026 |
| 0.2.0 | 31 | 2/8/2026 |
| 0.1.4 | 31 | 2/7/2026 |
| 0.1.3 | 33 | 2/7/2026 |
| 0.1.3-next | 33 | 2/7/2026 |
| 0.1.2-next | 26 | 2/7/2026 |
| 0.1.1-next | 33 | 2/7/2026 |
| 0.1.0-next | 36 | 2/7/2026 |