MagnusOpera.FScript.Language 0.12.0

Prefix Reserved
dotnet add package MagnusOpera.FScript.Language --version 0.12.0
                    
NuGet\Install-Package MagnusOpera.FScript.Language -Version 0.12.0
                    
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.12.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MagnusOpera.FScript.Language" Version="0.12.0" />
                    
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.12.0
                    
#r "nuget: MagnusOpera.FScript.Language, 0.12.0"
                    
#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.12.0
                    
#: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.12.0
                    
Install as a Cake Addin
#tool nuget:?package=MagnusOpera.FScript.Language&version=0.12.0
                    
Install as a Cake Tool

FScript

Build (main) NuGet Language NuGet Runtime

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, typeof type tokens, and nameof identifier tokens for host workflows.
  • unified brace literals for records/maps ({ Field = value }, { [key] = value }, {} for empty map).

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

Installation

CLI via Homebrew

brew install magnusopera/tap/fscript

Embeddable language via 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 net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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