Runtime externs and host integration layer for FScript.
$ dotnet add package MagnusOpera.FScript.Runtime
FScript is a lightweight, embeddable interpreter with an F#/ML-style language.
It is designed for host applications that need:
let/fun, algebraic modeling.FScript currently includes:
let, let rec, and mutual recursion, lambdas,if/elif/else, match, for ... in ... do,typeof type tokens, and nameof identifier tokens for host workflows.{ Field = value }, { [key] = value }, {} for empty map), with map keys typed as string.If you are new to FScript, start with the progressive tutorial:
It covers installation, syntax basics, flow control, collections, pattern matching, stdlib usage, includes, and host/export concepts.
brew install magnusopera/tap/fscriptMagnusOpera.FScript.LanguageMagnusOpera.FScript.RuntimeFScript 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).
https://marketplace.visualstudio.com/items?itemName=MagnusOpera.fscripthttps://open-vsx.org/extension/MagnusOpera/fscriptThe extension uses automatic .NET runtime acquisition via .NET Install Tool and falls back to dotnet from PATH when needed.
Source lives in vscode-fscript/.
make buildmake testdotnet run --project src/FScript -- samples/types-showcase.fssRun a script with script arguments (after --):
dotnet run --project src/FScript -- samples/fibonacci.fss -- 10Optional sandbox root override:
dotnet run --project src/FScript -- --root /tmp/sandbox samples/types-showcase.fssDisable default runtime externs (Registry.all):
dotnet run --project src/FScript -- --no-default-externs samples/types-showcase.fssLoad user extern providers from an assembly (repeatable):
dotnet run --project src/FScript -- --extern-assembly ./MyExterns.dll samples/types-showcase.fssRun a script from stdin:
cat samples/types-showcase.fss | dotnet run --project src/FScript -- -r .Run stdin mode with script arguments:
cat samples/types-showcase.fss | dotnet run --project src/FScript -- -r . -- foo barShow CLI version:
dotnet run --project src/FScript -- versionIn CLI execution modes, scripts get:
type Environment = { ScriptName: string option; Arguments: string list }let Env = ...Start REPL:
dotnet run --project src/FScript --Useful samples:
The core engine lives in src/FScript.Language and runs in four stages:
Host integration lives in src/FScript.Runtime.
FScript is extended through host-provided externs.
Each extern declares:
Built-in host extern families include Fs.*, Json.*, Xml.*, Regex.*, hashing, GUIDs, and print.
List.*, Map.*, and Option.* are provided by the embedded stdlib prelude.
For details and extension workflow, see docs/specs/external-functions.md.
FScript runs in-process. Security is capability-based:
Operational controls (timeouts, cancellation, resource limits, process/container isolation) are host responsibilities.
See docs/specs/sandbox-and-security.md for the full model and checklist.
docs/README.mddocs/guides/getting-started-tutorial.mddocs/specs/README.mddocs/architecture/README.mddocs/guides/fsharp-ocaml-differences.mdThis project is licensed under the MIT License.
See LICENSE.