@bramas/simulant-lang 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +43 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # @bramas/simulant-lang
2
+
3
+ Compiler and typed intermediate representation for Simulant, a language for
4
+ experiments on mobile entities and distributed algorithms. The compiler parses
5
+ `.sim` files, resolves imports, elaborates models and algorithms, lowers
6
+ structured procedures, and checks types and model capabilities.
7
+
8
+ For a complete project with a simulator and CLI:
9
+
10
+ ```sh
11
+ npm create @bramas/simulant@latest my-project
12
+ ```
13
+
14
+ ## Compiler API
15
+
16
+ ```sh
17
+ npm install @bramas/simulant-lang
18
+ ```
19
+
20
+ ```ts
21
+ import { loadProgram } from '@bramas/simulant-lang/elab/node';
22
+ import { compile } from '@bramas/simulant-lang/elab/elaborate';
23
+
24
+ const result = compile(loadProgram('src/main.sim'));
25
+ console.log(result.diagnostics);
26
+ console.log(Object.keys(result.experiments));
27
+ ```
28
+
29
+ Each entry in `result.experiments` contains diagnostics and, when compilation
30
+ succeeds, an `experiment`. `loadProgram` reads sources from disk and resolves
31
+ `std/*.sim` imports from the installed standard library. For custom source
32
+ storage, construct a `Program` with a source host instead.
33
+
34
+ Types are exported from `@bramas/simulant-lang/ir`; the independent TypeScript
35
+ IR builder is available at `@bramas/simulant-lang/builder`. This package uses
36
+ subpath exports; it has no root import. Execution and exploration belong to
37
+ `@bramas/simulant-engine`.
38
+
39
+ [Language reference](https://github.com/Bramas/simulant/blob/main/docs/sim-language.md)
40
+ · [IR contract](https://github.com/Bramas/simulant/blob/main/docs/ir.md)
41
+ · [Source](https://github.com/Bramas/simulant/tree/main/packages/lang)
42
+
43
+ Licensed under CeCILL-B; see `LICENCE.txt`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bramas/simulant-lang",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "license": "CECILL-B",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "LICENCE.txt"
21
21
  ],
22
22
  "dependencies": {
23
- "@bramas/simulant-stdlib": "0.1.1"
23
+ "@bramas/simulant-stdlib": "0.2.0"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",