Feersum is a Scheme compiler for .NET written in F#. It targets .NET 8 and is distributed as a .NET tool and MSBuild SDK. The compiler follows a classic multi-pass pipeline: parse → bind → lower → emit.
| Path | Contents |
|---|---|
src/Feersum/ |
Compiler executable (F#) |
src/Feersum.CompilerServices/ |
Core compiler passes — syntax, binding, lowering, emit |
src/Feersum.Core/ |
Scheme core libraries (.scmproj), e.g. base.sld, lists.sld |
src/Serehfa/ |
Runtime support and builtin implementations (C# + Scheme) |
src/Feersum.Sdk/ |
MSBuild SDK targets for .scmproj files |
src/Feersum.Templates/ |
dotnet new templates |
spec/ |
Snapshot-tested Scheme source files (.scm) and expected ASTs (.ast) |
test/ |
.NET test projects, including SpecTests.fs which drives the spec suite |
docs/ |
Published documentation and design documents |
examples/ |
Example Scheme projects using the SDK |
- Parse (
src/Feersum.CompilerServices/Syntax/Parse.fs, AST wrappers insrc/Feersum.CompilerServices/Syntax/Tree.fs) — text →AstNodetree with position info; errors produce stub nodes rather than hard failures. - Bind (
Binding/Binder.fs) —AstNode→ typed bound tree; resolves variables toStorageRefs, recognises special forms, identifies captures. - Lower (
Binding/Lower.fs) — rewrites captured-variable references to environment slots; hoists captured values; simplifies tree structure. - Emit (
Compile/Compiler.fs) — walks the bound tree and writes CIL bytecode viaMono.Cecil; globals becomepublic staticfields, locals stay as IL locals, captures useobject[]environment slots.
# Build
dotnet build
# Run tests
dotnet test
# Update spec snapshots after intentional output changes
UpdateSnapshots=true dotnet test
# Compile a single Scheme file
dotnet run --project src/Feersum -- yourfile.scmThe VS Code tasks build, test, and update-snapshots wrap the commands
above.
Spec files live in spec/. Each .scm file has a paired .ast snapshot. Run
dotnet test with UpdateSnapshots=true to regenerate snapshots after an
intentional change.
F# code in Feersum should follow the F# Style Guide. Ensure your code adheres to the conventions outlined there for naming, formatting, and general code organization.
- DEVGUIDE.md — detailed compiler structure walk-through
- CONTRIBUTING.md — contribution guidelines
- docs/design-docs/ — architectural design documents
- F# Style Guide — Microsoft's F# style and conventions guide
path: .agents/skills/design-documents/SKILL.md
name: design-documents
description: Write a new compiler design document in docs/design-docs/. Use when the user asks to document a design, write a design doc, or record architectural decisions for the Feersum compiler.
path: .agents/skills/ascii-header-formatting/SKILL.md
name: ascii-header-formatting
description: "Enforce ASCII-only section headers and comment banners. Use when writing or reviewing code comments, section dividers, or banner headers in any source file. Do not use Unicode box-drawing characters."
path: .agents/skills/fantomas-lint/SKILL.md
name: fantomas-lint
description: "Ensure F# source code is formatted cleanly with Fantomas before finishing a task. Use when writing or editing any F# source file, before committing changes, or when CI lint failures need to be fixed. Run Fantomas to reformat, then verify tests still pass."