Skip to content

Commit f372ed3

Browse files
committed
update documentation
1 parent 991d91f commit f372ed3

2 files changed

Lines changed: 80 additions & 8 deletions

File tree

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Each extern declares:
7777

7878
Built-in extern families include `List.*`, `Map.*`, `Option.*`, `Fs.*`, `Json.*`, `Xml.*`, `Regex.*`, hashing, GUIDs, and `print`.
7979

80-
For details and extension workflow, see `docs/external-functions.md`.
80+
For details and extension workflow, see [`docs/external-functions.md`](docs/external-functions.md).
8181

8282
## Sandbox and Security
8383

@@ -88,13 +88,14 @@ FScript runs in-process. Security is capability-based:
8888

8989
Operational controls (timeouts, cancellation, resource limits, process/container isolation) are host responsibilities.
9090

91-
See `docs/sandbox-and-security.md` for the full model and checklist.
91+
See [`docs/sandbox-and-security.md`](docs/sandbox-and-security.md) for the full model and checklist.
9292

9393
## Documentation
9494

95-
- `docs/syntax-and-indentation.md`
96-
- `docs/supported-types.md`
97-
- `docs/function-annotations.md`
98-
- `docs/external-functions.md`
99-
- `docs/sandbox-and-security.md`
100-
- `docs/fsharp-ocaml-differences.md`
95+
- [`docs/syntax-and-indentation.md`](docs/syntax-and-indentation.md)
96+
- [`docs/supported-types.md`](docs/supported-types.md)
97+
- [`docs/function-annotations.md`](docs/function-annotations.md)
98+
- [`docs/external-functions.md`](docs/external-functions.md)
99+
- [`docs/sandbox-and-security.md`](docs/sandbox-and-security.md)
100+
- [`docs/fsharp-ocaml-differences.md`](docs/fsharp-ocaml-differences.md)
101+
- [`docs/assemblies-and-roles.md`](docs/assemblies-and-roles.md)

docs/assemblies-and-roles.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# FScript Assemblies, Roles, and Usage
2+
3+
## Purpose
4+
This document describes how FScript is split into assemblies and how they are used together in applications.
5+
6+
## Assembly overview
7+
8+
### `FScript`
9+
Role:
10+
- Command-line tool (`fscript`) to execute `.fss` files.
11+
12+
Responsibilities:
13+
- Parse CLI arguments.
14+
- Resolve script path and sandbox root.
15+
- Build runtime context and extern registry.
16+
- Execute parse -> type inference -> evaluation pipeline.
17+
- Print final result and report parse/type/eval errors.
18+
19+
Use this when:
20+
- You want to run scripts directly from terminal/CI.
21+
- You want a ready-to-use executable without writing host integration code.
22+
23+
### `FScript.Language`
24+
Role:
25+
- Embeddable language engine.
26+
27+
Responsibilities:
28+
- Core language model and AST.
29+
- Lexer and parser.
30+
- Type system and Hindley-Milner inference.
31+
- Evaluator and value model.
32+
- Pretty-printing of evaluation results.
33+
34+
Use this when:
35+
- You want to embed the language in another .NET application.
36+
- You need language processing independently from default runtime extern catalog.
37+
38+
### `FScript.Runtime`
39+
Role:
40+
- Runtime integration layer and extern catalog.
41+
42+
Responsibilities:
43+
- Host context model (`RootDirectory` and related host constraints).
44+
- Built-in external function modules (`List.*`, `Map.*`, `Option.*`, filesystem, JSON/XML, regex, hash, GUID, print).
45+
- Extern registry composition.
46+
- Host-oriented decoding helpers and sandbox-aware path checks.
47+
48+
Use this when:
49+
- You want the built-in extern ecosystem ready to use.
50+
- You want a baseline runtime integration layer to extend with custom externs.
51+
52+
## Typical composition
53+
54+
### CLI execution path
55+
1. `FScript` reads CLI args and script text.
56+
2. `FScript` asks `FScript.Runtime` for externs (`Registry.all`).
57+
3. `FScript` invokes `FScript.Language` parse/infer/eval pipeline.
58+
4. `FScript` prints result.
59+
60+
### Embedded host path
61+
1. Host app references `FScript.Language` and (optionally) `FScript.Runtime`.
62+
2. Host builds `HostContext` and extern list.
63+
3. Host runs parse/infer/eval programmatically.
64+
4. Host decides output, logging, and error handling behavior.
65+
66+
## Dependency direction
67+
- `FScript.Language` has no dependency on `FScript.Runtime`.
68+
- `FScript.Runtime` depends on `FScript.Language` types.
69+
- `FScript` depends on both `FScript.Language` and `FScript.Runtime`.
70+
71+
This keeps the language engine reusable while runtime capabilities remain host-configurable.

0 commit comments

Comments
 (0)