MagnusOpera.FScript.Language 0.1.3

Prefix Reserved
There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MagnusOpera.FScript.Language" Version="0.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MagnusOpera.FScript.Language" Version="0.1.3" />
                    
Directory.Packages.props
<PackageReference Include="MagnusOpera.FScript.Language" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MagnusOpera.FScript.Language --version 0.1.3
                    
#r "nuget: MagnusOpera.FScript.Language, 0.1.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MagnusOpera.FScript.Language@0.1.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MagnusOpera.FScript.Language&version=0.1.3
                    
Install as a Cake Addin
#tool nuget:?package=MagnusOpera.FScript.Language&version=0.1.3
                    
Install as a Cake Tool

FScript

Build (main)

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, and mutual 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 typeof type 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.fss
  • samples/patterns-and-collections.fss
  • samples/tree.fss
  • samples/mutual-recursion.fss

Distribution

Homebrew

brew tap magnusopera/tap
brew install fscript

NuGet

  • MagnusOpera.FScript.Language
  • MagnusOpera.FScript.Runtime

Interpreter Architecture

The core engine lives in src/FScript.Language and runs in four stages:

  1. Lexing: indentation-aware tokenization.
  2. Parsing: AST construction with expression/layout rules.
  3. Type inference: Hindley-Milner inference + unification + optional annotations.
  4. 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

License

This project is licensed under the MIT License.
See LICENSE.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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