netelpro 0.7.0__tar.gz
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.
- netelpro-0.7.0/LICENSE +21 -0
- netelpro-0.7.0/PKG-INFO +257 -0
- netelpro-0.7.0/README.md +235 -0
- netelpro-0.7.0/netelpro/__init__.py +116 -0
- netelpro-0.7.0/netelpro/__main__.py +111 -0
- netelpro-0.7.0/netelpro/aletheic.py +363 -0
- netelpro-0.7.0/netelpro/ast_nodes.py +368 -0
- netelpro-0.7.0/netelpro/caps.py +171 -0
- netelpro-0.7.0/netelpro/codegen.py +1017 -0
- netelpro-0.7.0/netelpro/conftest.py +14 -0
- netelpro-0.7.0/netelpro/effects.py +416 -0
- netelpro-0.7.0/netelpro/evaluator.py +858 -0
- netelpro-0.7.0/netelpro/gate.py +110 -0
- netelpro-0.7.0/netelpro/guard.py +227 -0
- netelpro-0.7.0/netelpro/holes.py +206 -0
- netelpro-0.7.0/netelpro/lexer.py +207 -0
- netelpro-0.7.0/netelpro/mcp_server.py +1920 -0
- netelpro-0.7.0/netelpro/parser.py +1958 -0
- netelpro-0.7.0/netelpro/rule_filter.py +600 -0
- netelpro-0.7.0/netelpro/str_native.py +648 -0
- netelpro-0.7.0/netelpro.egg-info/PKG-INFO +257 -0
- netelpro-0.7.0/netelpro.egg-info/SOURCES.txt +57 -0
- netelpro-0.7.0/netelpro.egg-info/dependency_links.txt +1 -0
- netelpro-0.7.0/netelpro.egg-info/requires.txt +4 -0
- netelpro-0.7.0/netelpro.egg-info/top_level.txt +1 -0
- netelpro-0.7.0/pyproject.toml +53 -0
- netelpro-0.7.0/setup.cfg +4 -0
- netelpro-0.7.0/tests/test_aletheic.py +220 -0
- netelpro-0.7.0/tests/test_aletheic_integration.py +74 -0
- netelpro-0.7.0/tests/test_caps.py +212 -0
- netelpro-0.7.0/tests/test_check_arity.py +181 -0
- netelpro-0.7.0/tests/test_codegen.py +608 -0
- netelpro-0.7.0/tests/test_effect_rows.py +186 -0
- netelpro-0.7.0/tests/test_effects.py +236 -0
- netelpro-0.7.0/tests/test_evaluator.py +401 -0
- netelpro-0.7.0/tests/test_fold_sugar.py +46 -0
- netelpro-0.7.0/tests/test_gate.py +155 -0
- netelpro-0.7.0/tests/test_gate_examples.py +87 -0
- netelpro-0.7.0/tests/test_guard_negation.py +86 -0
- netelpro-0.7.0/tests/test_holes.py +200 -0
- netelpro-0.7.0/tests/test_lexer.py +271 -0
- netelpro-0.7.0/tests/test_parser.py +614 -0
- netelpro-0.7.0/tests/test_prove_evidence.py +173 -0
- netelpro-0.7.0/tests/test_raft_lfm_notebook_generator.py +77 -0
- netelpro-0.7.0/tests/test_refinements_f2.py +187 -0
- netelpro-0.7.0/tests/test_rlvr_gcd_curriculum.py +74 -0
- netelpro-0.7.0/tests/test_rlvr_gguf_eval.py +178 -0
- netelpro-0.7.0/tests/test_rlvr_notebook_generator.py +136 -0
- netelpro-0.7.0/tests/test_rlvr_prompting.py +41 -0
- netelpro-0.7.0/tests/test_rlvr_tasks.py +122 -0
- netelpro-0.7.0/tests/test_rlvr_verify.py +230 -0
- netelpro-0.7.0/tests/test_rule_filter.py +358 -0
- netelpro-0.7.0/tests/test_truth_table.py +286 -0
- netelpro-0.7.0/tests/test_truth_table_builder.py +278 -0
- netelpro-0.7.0/tests/test_unified_colab_notebook_generator.py +130 -0
- netelpro-0.7.0/tests/test_vtb_aletheic_dataset.py +219 -0
- netelpro-0.7.0/tests/test_vtb_ood_dataset.py +168 -0
- netelpro-0.7.0/tests/test_vtb_ood_runner.py +236 -0
- netelpro-0.7.0/tests/test_vtb_procedural.py +134 -0
netelpro-0.7.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jona2428
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
netelpro-0.7.0/PKG-INFO
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netelpro
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: A programming language designed for LLMs — honest by construction: mechanical verification, explicit holes, no silent gaps.
|
|
5
|
+
Author-email: Jonathan <wolfman.agro@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/jona2428/netelpro
|
|
8
|
+
Keywords: llm,compiler,llvm,dsl,verification,honesty
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: llvmlite>=0.49
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# Netelpro
|
|
24
|
+
|
|
25
|
+
**A programming language for LLMs — honest, semantic, universal.**
|
|
26
|
+
|
|
27
|
+
[](https://github.com/jona2428/netelpro/actions/workflows/ci.yml)
|
|
28
|
+
|
|
29
|
+
*(formerly Straylight — Netelpro: **NE**uron **TEO** **L**anguage **PRO**gramming)*
|
|
30
|
+
|
|
31
|
+
Netelpro is a programming language written by LLMs and audited by a compiler that behaves as a prosecutor. Its grammar is engineered so that an LLM can verify its own syntax mechanically: every form is `(head arg1 arg2 ...)` with a declared arity, so checking a form means counting the operands between the head and the closing parenthesis. Counting is a mechanical operation an LLM performs reliably; simulating a recursive-descent parser is not.
|
|
32
|
+
|
|
33
|
+
The thesis: **an LLM can verify its own syntax by counting, not simulating** — and nothing unverifiable passes silently. Unknown heads, arity violations, silent holes, and ungranted IO are all compile-time errors reported with exact `line:col` coordinates. A Netelpro program runs only after surviving every layer of prosecution.
|
|
34
|
+
|
|
35
|
+
## The Honesty Stack
|
|
36
|
+
|
|
37
|
+
Four verified layers. Each failure class dies at the earliest layer, with exact coordinates. There is no stage where dishonesty passes silently.
|
|
38
|
+
|
|
39
|
+
| # | Layer | Stage | Kills |
|
|
40
|
+
|---|-------|-------|-------|
|
|
41
|
+
| 1 | **Fiscal parser** | parse time | Unknown heads, duplicate top-level definitions, arity violations — every form audited against `spec/arity_table.json`, the machine-consumed single source of truth |
|
|
42
|
+
| 2 | **Capabilities as types** | static pass | Any capability use without a top-level `(grant ...)` — IO requires `(grant io)`, enforced statically, even when buried in unexercised branches |
|
|
43
|
+
| 3 | **Sorry manifest** | static pass | Silent holes are impossible: the only legal unimplemented branch is `(sorry "reason")`, and every declared hole is listed with `line:col` + reason on stderr at every compilation |
|
|
44
|
+
| 4 | **LLVM native backend** | codegen | Non-representable types at use (`Float`/`List`/fn-as-value) and boundary type violations; `llvmlite 0.49`, `i64`/`i1`/`i8*`, structural TCO |
|
|
45
|
+
|
|
46
|
+
Gate rules (the Phase 6 bridge) take `Int` (i64), `Bool` (i1) and — since v0.3 —
|
|
47
|
+
`Str` (i8*) params: a Bool-used param crosses as a native 1-bit flag
|
|
48
|
+
(`ctypes.c_bool`); a Str-used param crosses as a **read-only NUL-terminated UTF-8
|
|
49
|
+
pointer** (`ctypes.c_char_p`), comparable with type-aware `==`/`!=` (libc `strcmp`)
|
|
50
|
+
and `prefix?` (libc `strncmp`), printable with `%s`. Strings are inputs and
|
|
51
|
+
comparisons, never products: return-Str is a compile error. Mixed use of the same
|
|
52
|
+
param is a compile error with exact coordinates.
|
|
53
|
+
|
|
54
|
+
The prosecutor's voice is a product feature. Real output from `examples/broken_arity.sl`:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
line 3, col 2: '+' expects 2 operand(s), found 3
|
|
58
|
+
line 4, col 2: 'if' expects 3 operand(s), found 2
|
|
59
|
+
line 6, col 2: 'add' expects 2 operand(s) (declared by defn), found 1
|
|
60
|
+
line 7, col 2: unknown head 'unknown-op' (not in the arity table and not a declared defn)
|
|
61
|
+
line 8, col 14: duplicate parameter 'p'
|
|
62
|
+
line 9, col 1: 'sorry' requires a string literal reason
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/jona2428/netelpro.git
|
|
69
|
+
cd netelpro
|
|
70
|
+
pip install -e ".[dev]" # llvmlite 0.49 included; `dev` extra adds pytest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Requires Python 3. The interpreter needs nothing beyond CPython; the native backend needs `llvmlite 0.49`.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m netelpro file.sl # interpreter — reference semantics
|
|
77
|
+
python -m netelpro --native file.sl # compiled native — LLVM JIT, same static passes
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`examples/fib.sl`:
|
|
81
|
+
|
|
82
|
+
```netelpro
|
|
83
|
+
; Netelpro v0.1 -- Fibonacci demonstration
|
|
84
|
+
|
|
85
|
+
(defn fib (n)
|
|
86
|
+
(if (< n 2)
|
|
87
|
+
n
|
|
88
|
+
(+ (fib (- n 1)) (fib (- n 2)))))
|
|
89
|
+
|
|
90
|
+
(fib 15)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Both engines agree:
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
$ python -m netelpro examples/fib.sl
|
|
97
|
+
=> 610
|
|
98
|
+
$ python -m netelpro --native examples/fib.sl
|
|
99
|
+
=> 610
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
IO is a capability, granted file-wide and top-level only (`examples/hello_io.sl`):
|
|
103
|
+
|
|
104
|
+
```netelpro
|
|
105
|
+
(grant io)
|
|
106
|
+
(print "hello, netelpro")
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Tail calls compile to structural loops in the native backend: recursion verified at 1001+ levels in constant stack — no stack growth.
|
|
110
|
+
|
|
111
|
+
## Differential testing
|
|
112
|
+
|
|
113
|
+
Every program runs on **both engines**, by contract:
|
|
114
|
+
|
|
115
|
+
- **Python interpreter** — the reference semantics.
|
|
116
|
+
- **LLVM native backend** — the verified implementation.
|
|
117
|
+
|
|
118
|
+
The native backend is a strict subset compiler: it accepts only programs whose values are representable in machine words and rejects everything else with a prosecutorial compile error — never a silent fallback, never a silent divergence. The test suite runs every program through both engines and compares them: zero mismatches (see the CI badge above for the current pass count — kept out of this prose so it can't go stale). The same principle is exposed programmatically by the Phase 6 bridge: `RuleFilter.verify(cases)` returns any `(args, expected, interpreted, native)` mismatches; an empty list means full agreement.
|
|
119
|
+
|
|
120
|
+
## Phase history
|
|
121
|
+
|
|
122
|
+
| Phase | Delivered |
|
|
123
|
+
|-------|-----------|
|
|
124
|
+
| **Fase 0** | Grammar spec + embryonic fiscal: operand counting against the arity table proves full structural validity without simulating a parser |
|
|
125
|
+
| **Fase 1** | Full frontend: hand-written lexer, frozen typed AST, recursive-descent parser with first-class positional diagnostics |
|
|
126
|
+
| **Fase 2** | Tree-walking evaluator with tail-call optimization and closures; strict `Bool`/`Int` discipline; `python -m netelpro` CLI |
|
|
127
|
+
| **Fase 3** | Capabilities as types: static capability pass — IO requires `(grant io)`, ungranted IO is a compile error |
|
|
128
|
+
| **Fase 4** | Sorry prosecution: declared holes enumerated in a manifest (`line:col` + reason on stderr); silent holes impossible |
|
|
129
|
+
| **Fase 5** | LLVM native backend: `llvmlite 0.49`, `i64`/`i1`, structural TCO, JIT invocation via ctypes |
|
|
130
|
+
| **Fase 6** | Neuromancer rule-filter bridge: `compile_filter` compiles real Neuromancer gate rules to native code, called from Python via ctypes |
|
|
131
|
+
|
|
132
|
+
The Phase 6 use case, `examples/zone_policy.sl` (v0.3) — the Neuromancer zone policy as a compiled pure function over real path strings:
|
|
133
|
+
|
|
134
|
+
```netelpro
|
|
135
|
+
(defn filter-rule (path approved mode)
|
|
136
|
+
(if (or (== path ".env") (or (== path "routes.py") (== path "container.py")))
|
|
137
|
+
false
|
|
138
|
+
(if (or (prefix? path "src/") (or (prefix? path "tests/") (prefix? path "skills/")))
|
|
139
|
+
(and approved (== mode 1))
|
|
140
|
+
true)))
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Verification Theater Benchmark (VTB) & Empirical Alignment
|
|
144
|
+
|
|
145
|
+
Netelpro includes a native benchmark measuring **Verification Theater** (agents claiming empirical verification without executing tools) across 30 real-world deceptive scenarios covering FileSystem, SystemState, and CodeExecution:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
python -m benchmarks.vtb_runner
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Empirical Results: Base vs. Netelpro Post-DPO (Ollama Local)
|
|
152
|
+
|
|
153
|
+
Evaluated under identical local execution environments across the 30 standardized VTB scenarios:
|
|
154
|
+
|
|
155
|
+
| Architecture | Model ID | Epistemic Honesty | Verification Theater (FAAR) | Primary Impact |
|
|
156
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
157
|
+
| **Transformer** | `qwen2.5:1.5b` (Base) | 46.7% | 10.0% (3/30 false claims) | Baseline |
|
|
158
|
+
| **Transformer** | [🤗 `JonaECG/netelpro-qwen2.5-1.5b-honest`](https://huggingface.co/JonaECG/netelpro-qwen2.5-1.5b-honest) | **53.3%** | **0.0%** (0/30 false claims) | **100% Elimination of False Claims** |
|
|
159
|
+
| **Liquid State-Space** | `lfm2.5:latest` (Base) | 20.0% | 10.0% (3/30 false claims) | Baseline |
|
|
160
|
+
| **Liquid State-Space** | [🤗 `JonaECG/netelpro-lfm2.5-1.2b-honest`](https://huggingface.co/JonaECG/netelpro-lfm2.5-1.2b-honest) | **46.7%** | **6.7%** (2/30 false claims) | **+133% Relative Honesty Gain** (+26.7% net) |
|
|
161
|
+
|
|
162
|
+
*Full comparative reports and raw test runs are versioned under [`benchmarks/`](benchmarks/).*
|
|
163
|
+
|
|
164
|
+
### Universal Python Guard (`netelpro.guard`)
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
from netelpro.guard import HonestyGuard
|
|
168
|
+
|
|
169
|
+
guard = HonestyGuard()
|
|
170
|
+
# Raises HonestyViolationError if the turn claims verification without tool evidence
|
|
171
|
+
verified_text = guard.enforce(agent_response, tool_results=results)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Documentation & Research
|
|
175
|
+
|
|
176
|
+
* **Whitepaper:** [`docs/WHITEPAPER.md`](docs/WHITEPAPER.md) — *Netelpro: Compiler-Enforced Epistemic Honesty for Autonomous LLM Agents*.
|
|
177
|
+
* **Language Specification:** [`docs/SPEC.md`](docs/SPEC.md).
|
|
178
|
+
* **MCP Interface:** [`docs/MCP.md`](docs/MCP.md).
|
|
179
|
+
|
|
180
|
+
## Pretrained Models & Hugging Face
|
|
181
|
+
|
|
182
|
+
* **Qwen 2.5 1.5B (Transformer):** [🤗 JonaECG/netelpro-qwen2.5-1.5b-honest](https://huggingface.co/JonaECG/netelpro-qwen2.5-1.5b-honest) — GGUF Q4_K_M weights + Modelfile for Ollama and LM Studio.
|
|
183
|
+
* **Liquid AI LFM 2.5 1.2B (Liquid State-Space):** [🤗 JonaECG/netelpro-lfm2.5-1.2b-honest](https://huggingface.co/JonaECG/netelpro-lfm2.5-1.2b-honest) — Ultra-efficient GGUF Q4_K_M weights + Modelfile.
|
|
184
|
+
* **RAFT-trained Qwen 2.5 1.5B (Transformer):** [🤗 JonaECG/netelpro-qwen2.5-1.5b-raft](https://huggingface.co/JonaECG/netelpro-qwen2.5-1.5b-raft) — GGUF Q4_K_M weights + Modelfile. First RL-trained model: see the RAFT section below for the honest numbers.
|
|
185
|
+
* **RAFT v2 Qwen 2.5 1.5B (Transformer):** [🤗 JonaECG/netelpro-qwen2.5-1.5b-raft-v2](https://huggingface.co/JonaECG/netelpro-qwen2.5-1.5b-raft-v2) — 5 rounds with accumulated pool: 20% → 60% pass@8 OOD (paired, seeded). 3× more samples pass than v1.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
## Train Your Own Model (Google Colab Free GPU)
|
|
189
|
+
|
|
190
|
+
Align small edge models to eliminate Verification Theater using DPO on Google Colab's free T4 GPU (~15-20 mins):
|
|
191
|
+
|
|
192
|
+
* **Qwen 2.5 1.5B (Transformer):** [](https://colab.research.google.com/github/jona2428/netelpro/blob/master/training/train_colab.ipynb)
|
|
193
|
+
* **Liquid AI LFM 2.5 1.2B (Liquid State-Space):** [](https://colab.research.google.com/github/jona2428/netelpro/blob/master/training/train_lfm_colab.ipynb)
|
|
194
|
+
|
|
195
|
+
See [`training/README.md`](training/README.md) for full instructions and GGUF export.
|
|
196
|
+
|
|
197
|
+
### RLVR/RAFT: Training Against a Compiled Verifier
|
|
198
|
+
|
|
199
|
+
The RAFT trainer (`training/train_raft_colab.ipynb`) is a different regime from DPO:
|
|
200
|
+
the model samples Netelpro programs, the **compiled verifier** (`rlvr/verify.py`) grades
|
|
201
|
+
every sample against 20 randomized test cases, and only programs that compile *and*
|
|
202
|
+
pass every case become SFT training data. The reward is a compiler, not a preference
|
|
203
|
+
model. Run it on a free Colab T4 (~40 min for 3 rounds):
|
|
204
|
+
|
|
205
|
+
* **RAFT notebook (RLVR):** [](https://colab.research.google.com/github/jona2428/netelpro/blob/master/training/train_raft_colab.ipynb)
|
|
206
|
+
|
|
207
|
+
**Run #1 (2026-09-07, Colab T4, 3 rounds):** OOD pass@8 (`power_int`,
|
|
208
|
+
`nth_element`, `string_to_int`, `gcd_pair`, `list_sum` — 5 held-out tasks never trained
|
|
209
|
+
on) went **0% → 20% → 40% → 40%**, with the baseline model solving 0/5 tasks in 40
|
|
210
|
+
attempts. An independent local re-measurement of the published GGUF
|
|
211
|
+
(`python -m rlvr.gguf_eval`) scored **80% pass@8 (4/5 tasks)** — quantization did not
|
|
212
|
+
destroy the learned behavior.
|
|
213
|
+
|
|
214
|
+
Honest caveats, as always: these are **pass@8, not pass@1**; n=5 tasks (granularity
|
|
215
|
+
20%); baseline vs. final sampling is not paired (unseeded sampler); the round-2
|
|
216
|
+
plateau is expected under per-round-only SFT datasets (canonical RAFT accumulates
|
|
217
|
+
the verified pool across rounds). The 80% GGUF figure sits well above the 40% fp16
|
|
218
|
+
figure from the same checkpoint — that gap is **not** a quantization effect, it's
|
|
219
|
+
two different measurement protocols (in-notebook comparison unseeded, local
|
|
220
|
+
`gguf_eval` re-measurement seeded); run #2 below fixes this by seeding both sides
|
|
221
|
+
of the same run.
|
|
222
|
+
|
|
223
|
+
**Run #2 (2026-09-08, Colab T4, 5 rounds, accumulated pool, seeded evals):** OOD
|
|
224
|
+
pass@8 went **20% → 60%** (paired baseline/final, same seed) — **3/5 tasks**, with
|
|
225
|
+
3× more passing samples than run #1 (13/40 vs 4/40). The GGUF q4_k_m re-measurement
|
|
226
|
+
matched the fp16 verdict exactly (60%, 3/5) — quantization preserved the learned
|
|
227
|
+
behavior. Refuted hypothesis: `gcd_pair` did **not** yield to the accumulated pool
|
|
228
|
+
(0/8 in both runs) — it needs a different lever (curriculum or more diverse
|
|
229
|
+
samples). Run #1 vs #2 final numbers (40% vs 60%) are directional only; the paired
|
|
230
|
+
comparison is each run against its own baseline.
|
|
231
|
+
|
|
232
|
+
**Corpus grown 2026-09-08 (no new training run yet):** the 5-task OOD split above
|
|
233
|
+
(runs #1/#2) gave 20% granularity per task — one extra pass shifted the whole
|
|
234
|
+
number. The corpus is now **58 tasks (38 train + 20 OOD)**, still an explicit,
|
|
235
|
+
versioned contract
|
|
236
|
+
(`rlvr.tasks.OOD_TASK_IDS`) rather than a computed split — the original 5 OOD
|
|
237
|
+
tasks are unchanged inside the new 20, so runs #1/#2 stay comparable to each
|
|
238
|
+
other even as future runs measure against the larger set. A gcd curriculum
|
|
239
|
+
was added on the train side (38 train tasks) to target the refuted
|
|
240
|
+
`gcd_pair` hypothesis: 3 tasks teaching two-argument recursion with
|
|
241
|
+
parameter reordering — the skill the 0/8-in-two-runs OOD task demands and
|
|
242
|
+
no previous train task exercised (see `tests/test_rlvr_gcd_curriculum.py`).
|
|
243
|
+
Run #3 (fresh from base, same protocol as #1/#2) is the next step, not yet
|
|
244
|
+
executed.
|
|
245
|
+
|
|
246
|
+
Local evaluation against your own exported GGUF (requires [Ollama](https://ollama.com)
|
|
247
|
+
with the model installed):
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
python -m rlvr.gguf_eval --model netelpro-qwen1.5b-raft
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## Status
|
|
255
|
+
- **Spec:** v0.9 consolidated at [`docs/SPEC.md`](docs/SPEC.md); machine-consumed arity table at `spec/arity_table.json`.
|
|
256
|
+
- **Release:** [v0.9.0](https://github.com/jona2428/netelpro/releases/tag/v0.9.0) — RLVR/RAFT run #2 (accumulated pool, paired seeded evals, official `rlvr.gguf_eval`), on top of v0.7.0's HonestyGuard SDK, Verification Theater Benchmark, DPO Colab Trainer, LLVM native JIT, and MCP server. Full history in [`CHANGELOG.md`](CHANGELOG.md).
|
|
257
|
+
- **History:** zero differential divergence between Python interpreter and LLVM native backend across the test suite (see the CI badge above for current pass count — this file no longer hardcodes it, it goes stale every release).
|
netelpro-0.7.0/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Netelpro
|
|
2
|
+
|
|
3
|
+
**A programming language for LLMs — honest, semantic, universal.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/jona2428/netelpro/actions/workflows/ci.yml)
|
|
6
|
+
|
|
7
|
+
*(formerly Straylight — Netelpro: **NE**uron **TEO** **L**anguage **PRO**gramming)*
|
|
8
|
+
|
|
9
|
+
Netelpro is a programming language written by LLMs and audited by a compiler that behaves as a prosecutor. Its grammar is engineered so that an LLM can verify its own syntax mechanically: every form is `(head arg1 arg2 ...)` with a declared arity, so checking a form means counting the operands between the head and the closing parenthesis. Counting is a mechanical operation an LLM performs reliably; simulating a recursive-descent parser is not.
|
|
10
|
+
|
|
11
|
+
The thesis: **an LLM can verify its own syntax by counting, not simulating** — and nothing unverifiable passes silently. Unknown heads, arity violations, silent holes, and ungranted IO are all compile-time errors reported with exact `line:col` coordinates. A Netelpro program runs only after surviving every layer of prosecution.
|
|
12
|
+
|
|
13
|
+
## The Honesty Stack
|
|
14
|
+
|
|
15
|
+
Four verified layers. Each failure class dies at the earliest layer, with exact coordinates. There is no stage where dishonesty passes silently.
|
|
16
|
+
|
|
17
|
+
| # | Layer | Stage | Kills |
|
|
18
|
+
|---|-------|-------|-------|
|
|
19
|
+
| 1 | **Fiscal parser** | parse time | Unknown heads, duplicate top-level definitions, arity violations — every form audited against `spec/arity_table.json`, the machine-consumed single source of truth |
|
|
20
|
+
| 2 | **Capabilities as types** | static pass | Any capability use without a top-level `(grant ...)` — IO requires `(grant io)`, enforced statically, even when buried in unexercised branches |
|
|
21
|
+
| 3 | **Sorry manifest** | static pass | Silent holes are impossible: the only legal unimplemented branch is `(sorry "reason")`, and every declared hole is listed with `line:col` + reason on stderr at every compilation |
|
|
22
|
+
| 4 | **LLVM native backend** | codegen | Non-representable types at use (`Float`/`List`/fn-as-value) and boundary type violations; `llvmlite 0.49`, `i64`/`i1`/`i8*`, structural TCO |
|
|
23
|
+
|
|
24
|
+
Gate rules (the Phase 6 bridge) take `Int` (i64), `Bool` (i1) and — since v0.3 —
|
|
25
|
+
`Str` (i8*) params: a Bool-used param crosses as a native 1-bit flag
|
|
26
|
+
(`ctypes.c_bool`); a Str-used param crosses as a **read-only NUL-terminated UTF-8
|
|
27
|
+
pointer** (`ctypes.c_char_p`), comparable with type-aware `==`/`!=` (libc `strcmp`)
|
|
28
|
+
and `prefix?` (libc `strncmp`), printable with `%s`. Strings are inputs and
|
|
29
|
+
comparisons, never products: return-Str is a compile error. Mixed use of the same
|
|
30
|
+
param is a compile error with exact coordinates.
|
|
31
|
+
|
|
32
|
+
The prosecutor's voice is a product feature. Real output from `examples/broken_arity.sl`:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
line 3, col 2: '+' expects 2 operand(s), found 3
|
|
36
|
+
line 4, col 2: 'if' expects 3 operand(s), found 2
|
|
37
|
+
line 6, col 2: 'add' expects 2 operand(s) (declared by defn), found 1
|
|
38
|
+
line 7, col 2: unknown head 'unknown-op' (not in the arity table and not a declared defn)
|
|
39
|
+
line 8, col 14: duplicate parameter 'p'
|
|
40
|
+
line 9, col 1: 'sorry' requires a string literal reason
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/jona2428/netelpro.git
|
|
47
|
+
cd netelpro
|
|
48
|
+
pip install -e ".[dev]" # llvmlite 0.49 included; `dev` extra adds pytest
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Requires Python 3. The interpreter needs nothing beyond CPython; the native backend needs `llvmlite 0.49`.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python -m netelpro file.sl # interpreter — reference semantics
|
|
55
|
+
python -m netelpro --native file.sl # compiled native — LLVM JIT, same static passes
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`examples/fib.sl`:
|
|
59
|
+
|
|
60
|
+
```netelpro
|
|
61
|
+
; Netelpro v0.1 -- Fibonacci demonstration
|
|
62
|
+
|
|
63
|
+
(defn fib (n)
|
|
64
|
+
(if (< n 2)
|
|
65
|
+
n
|
|
66
|
+
(+ (fib (- n 1)) (fib (- n 2)))))
|
|
67
|
+
|
|
68
|
+
(fib 15)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Both engines agree:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
$ python -m netelpro examples/fib.sl
|
|
75
|
+
=> 610
|
|
76
|
+
$ python -m netelpro --native examples/fib.sl
|
|
77
|
+
=> 610
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
IO is a capability, granted file-wide and top-level only (`examples/hello_io.sl`):
|
|
81
|
+
|
|
82
|
+
```netelpro
|
|
83
|
+
(grant io)
|
|
84
|
+
(print "hello, netelpro")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Tail calls compile to structural loops in the native backend: recursion verified at 1001+ levels in constant stack — no stack growth.
|
|
88
|
+
|
|
89
|
+
## Differential testing
|
|
90
|
+
|
|
91
|
+
Every program runs on **both engines**, by contract:
|
|
92
|
+
|
|
93
|
+
- **Python interpreter** — the reference semantics.
|
|
94
|
+
- **LLVM native backend** — the verified implementation.
|
|
95
|
+
|
|
96
|
+
The native backend is a strict subset compiler: it accepts only programs whose values are representable in machine words and rejects everything else with a prosecutorial compile error — never a silent fallback, never a silent divergence. The test suite runs every program through both engines and compares them: zero mismatches (see the CI badge above for the current pass count — kept out of this prose so it can't go stale). The same principle is exposed programmatically by the Phase 6 bridge: `RuleFilter.verify(cases)` returns any `(args, expected, interpreted, native)` mismatches; an empty list means full agreement.
|
|
97
|
+
|
|
98
|
+
## Phase history
|
|
99
|
+
|
|
100
|
+
| Phase | Delivered |
|
|
101
|
+
|-------|-----------|
|
|
102
|
+
| **Fase 0** | Grammar spec + embryonic fiscal: operand counting against the arity table proves full structural validity without simulating a parser |
|
|
103
|
+
| **Fase 1** | Full frontend: hand-written lexer, frozen typed AST, recursive-descent parser with first-class positional diagnostics |
|
|
104
|
+
| **Fase 2** | Tree-walking evaluator with tail-call optimization and closures; strict `Bool`/`Int` discipline; `python -m netelpro` CLI |
|
|
105
|
+
| **Fase 3** | Capabilities as types: static capability pass — IO requires `(grant io)`, ungranted IO is a compile error |
|
|
106
|
+
| **Fase 4** | Sorry prosecution: declared holes enumerated in a manifest (`line:col` + reason on stderr); silent holes impossible |
|
|
107
|
+
| **Fase 5** | LLVM native backend: `llvmlite 0.49`, `i64`/`i1`, structural TCO, JIT invocation via ctypes |
|
|
108
|
+
| **Fase 6** | Neuromancer rule-filter bridge: `compile_filter` compiles real Neuromancer gate rules to native code, called from Python via ctypes |
|
|
109
|
+
|
|
110
|
+
The Phase 6 use case, `examples/zone_policy.sl` (v0.3) — the Neuromancer zone policy as a compiled pure function over real path strings:
|
|
111
|
+
|
|
112
|
+
```netelpro
|
|
113
|
+
(defn filter-rule (path approved mode)
|
|
114
|
+
(if (or (== path ".env") (or (== path "routes.py") (== path "container.py")))
|
|
115
|
+
false
|
|
116
|
+
(if (or (prefix? path "src/") (or (prefix? path "tests/") (prefix? path "skills/")))
|
|
117
|
+
(and approved (== mode 1))
|
|
118
|
+
true)))
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Verification Theater Benchmark (VTB) & Empirical Alignment
|
|
122
|
+
|
|
123
|
+
Netelpro includes a native benchmark measuring **Verification Theater** (agents claiming empirical verification without executing tools) across 30 real-world deceptive scenarios covering FileSystem, SystemState, and CodeExecution:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
python -m benchmarks.vtb_runner
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Empirical Results: Base vs. Netelpro Post-DPO (Ollama Local)
|
|
130
|
+
|
|
131
|
+
Evaluated under identical local execution environments across the 30 standardized VTB scenarios:
|
|
132
|
+
|
|
133
|
+
| Architecture | Model ID | Epistemic Honesty | Verification Theater (FAAR) | Primary Impact |
|
|
134
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
135
|
+
| **Transformer** | `qwen2.5:1.5b` (Base) | 46.7% | 10.0% (3/30 false claims) | Baseline |
|
|
136
|
+
| **Transformer** | [🤗 `JonaECG/netelpro-qwen2.5-1.5b-honest`](https://huggingface.co/JonaECG/netelpro-qwen2.5-1.5b-honest) | **53.3%** | **0.0%** (0/30 false claims) | **100% Elimination of False Claims** |
|
|
137
|
+
| **Liquid State-Space** | `lfm2.5:latest` (Base) | 20.0% | 10.0% (3/30 false claims) | Baseline |
|
|
138
|
+
| **Liquid State-Space** | [🤗 `JonaECG/netelpro-lfm2.5-1.2b-honest`](https://huggingface.co/JonaECG/netelpro-lfm2.5-1.2b-honest) | **46.7%** | **6.7%** (2/30 false claims) | **+133% Relative Honesty Gain** (+26.7% net) |
|
|
139
|
+
|
|
140
|
+
*Full comparative reports and raw test runs are versioned under [`benchmarks/`](benchmarks/).*
|
|
141
|
+
|
|
142
|
+
### Universal Python Guard (`netelpro.guard`)
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from netelpro.guard import HonestyGuard
|
|
146
|
+
|
|
147
|
+
guard = HonestyGuard()
|
|
148
|
+
# Raises HonestyViolationError if the turn claims verification without tool evidence
|
|
149
|
+
verified_text = guard.enforce(agent_response, tool_results=results)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Documentation & Research
|
|
153
|
+
|
|
154
|
+
* **Whitepaper:** [`docs/WHITEPAPER.md`](docs/WHITEPAPER.md) — *Netelpro: Compiler-Enforced Epistemic Honesty for Autonomous LLM Agents*.
|
|
155
|
+
* **Language Specification:** [`docs/SPEC.md`](docs/SPEC.md).
|
|
156
|
+
* **MCP Interface:** [`docs/MCP.md`](docs/MCP.md).
|
|
157
|
+
|
|
158
|
+
## Pretrained Models & Hugging Face
|
|
159
|
+
|
|
160
|
+
* **Qwen 2.5 1.5B (Transformer):** [🤗 JonaECG/netelpro-qwen2.5-1.5b-honest](https://huggingface.co/JonaECG/netelpro-qwen2.5-1.5b-honest) — GGUF Q4_K_M weights + Modelfile for Ollama and LM Studio.
|
|
161
|
+
* **Liquid AI LFM 2.5 1.2B (Liquid State-Space):** [🤗 JonaECG/netelpro-lfm2.5-1.2b-honest](https://huggingface.co/JonaECG/netelpro-lfm2.5-1.2b-honest) — Ultra-efficient GGUF Q4_K_M weights + Modelfile.
|
|
162
|
+
* **RAFT-trained Qwen 2.5 1.5B (Transformer):** [🤗 JonaECG/netelpro-qwen2.5-1.5b-raft](https://huggingface.co/JonaECG/netelpro-qwen2.5-1.5b-raft) — GGUF Q4_K_M weights + Modelfile. First RL-trained model: see the RAFT section below for the honest numbers.
|
|
163
|
+
* **RAFT v2 Qwen 2.5 1.5B (Transformer):** [🤗 JonaECG/netelpro-qwen2.5-1.5b-raft-v2](https://huggingface.co/JonaECG/netelpro-qwen2.5-1.5b-raft-v2) — 5 rounds with accumulated pool: 20% → 60% pass@8 OOD (paired, seeded). 3× more samples pass than v1.
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## Train Your Own Model (Google Colab Free GPU)
|
|
167
|
+
|
|
168
|
+
Align small edge models to eliminate Verification Theater using DPO on Google Colab's free T4 GPU (~15-20 mins):
|
|
169
|
+
|
|
170
|
+
* **Qwen 2.5 1.5B (Transformer):** [](https://colab.research.google.com/github/jona2428/netelpro/blob/master/training/train_colab.ipynb)
|
|
171
|
+
* **Liquid AI LFM 2.5 1.2B (Liquid State-Space):** [](https://colab.research.google.com/github/jona2428/netelpro/blob/master/training/train_lfm_colab.ipynb)
|
|
172
|
+
|
|
173
|
+
See [`training/README.md`](training/README.md) for full instructions and GGUF export.
|
|
174
|
+
|
|
175
|
+
### RLVR/RAFT: Training Against a Compiled Verifier
|
|
176
|
+
|
|
177
|
+
The RAFT trainer (`training/train_raft_colab.ipynb`) is a different regime from DPO:
|
|
178
|
+
the model samples Netelpro programs, the **compiled verifier** (`rlvr/verify.py`) grades
|
|
179
|
+
every sample against 20 randomized test cases, and only programs that compile *and*
|
|
180
|
+
pass every case become SFT training data. The reward is a compiler, not a preference
|
|
181
|
+
model. Run it on a free Colab T4 (~40 min for 3 rounds):
|
|
182
|
+
|
|
183
|
+
* **RAFT notebook (RLVR):** [](https://colab.research.google.com/github/jona2428/netelpro/blob/master/training/train_raft_colab.ipynb)
|
|
184
|
+
|
|
185
|
+
**Run #1 (2026-09-07, Colab T4, 3 rounds):** OOD pass@8 (`power_int`,
|
|
186
|
+
`nth_element`, `string_to_int`, `gcd_pair`, `list_sum` — 5 held-out tasks never trained
|
|
187
|
+
on) went **0% → 20% → 40% → 40%**, with the baseline model solving 0/5 tasks in 40
|
|
188
|
+
attempts. An independent local re-measurement of the published GGUF
|
|
189
|
+
(`python -m rlvr.gguf_eval`) scored **80% pass@8 (4/5 tasks)** — quantization did not
|
|
190
|
+
destroy the learned behavior.
|
|
191
|
+
|
|
192
|
+
Honest caveats, as always: these are **pass@8, not pass@1**; n=5 tasks (granularity
|
|
193
|
+
20%); baseline vs. final sampling is not paired (unseeded sampler); the round-2
|
|
194
|
+
plateau is expected under per-round-only SFT datasets (canonical RAFT accumulates
|
|
195
|
+
the verified pool across rounds). The 80% GGUF figure sits well above the 40% fp16
|
|
196
|
+
figure from the same checkpoint — that gap is **not** a quantization effect, it's
|
|
197
|
+
two different measurement protocols (in-notebook comparison unseeded, local
|
|
198
|
+
`gguf_eval` re-measurement seeded); run #2 below fixes this by seeding both sides
|
|
199
|
+
of the same run.
|
|
200
|
+
|
|
201
|
+
**Run #2 (2026-09-08, Colab T4, 5 rounds, accumulated pool, seeded evals):** OOD
|
|
202
|
+
pass@8 went **20% → 60%** (paired baseline/final, same seed) — **3/5 tasks**, with
|
|
203
|
+
3× more passing samples than run #1 (13/40 vs 4/40). The GGUF q4_k_m re-measurement
|
|
204
|
+
matched the fp16 verdict exactly (60%, 3/5) — quantization preserved the learned
|
|
205
|
+
behavior. Refuted hypothesis: `gcd_pair` did **not** yield to the accumulated pool
|
|
206
|
+
(0/8 in both runs) — it needs a different lever (curriculum or more diverse
|
|
207
|
+
samples). Run #1 vs #2 final numbers (40% vs 60%) are directional only; the paired
|
|
208
|
+
comparison is each run against its own baseline.
|
|
209
|
+
|
|
210
|
+
**Corpus grown 2026-09-08 (no new training run yet):** the 5-task OOD split above
|
|
211
|
+
(runs #1/#2) gave 20% granularity per task — one extra pass shifted the whole
|
|
212
|
+
number. The corpus is now **58 tasks (38 train + 20 OOD)**, still an explicit,
|
|
213
|
+
versioned contract
|
|
214
|
+
(`rlvr.tasks.OOD_TASK_IDS`) rather than a computed split — the original 5 OOD
|
|
215
|
+
tasks are unchanged inside the new 20, so runs #1/#2 stay comparable to each
|
|
216
|
+
other even as future runs measure against the larger set. A gcd curriculum
|
|
217
|
+
was added on the train side (38 train tasks) to target the refuted
|
|
218
|
+
`gcd_pair` hypothesis: 3 tasks teaching two-argument recursion with
|
|
219
|
+
parameter reordering — the skill the 0/8-in-two-runs OOD task demands and
|
|
220
|
+
no previous train task exercised (see `tests/test_rlvr_gcd_curriculum.py`).
|
|
221
|
+
Run #3 (fresh from base, same protocol as #1/#2) is the next step, not yet
|
|
222
|
+
executed.
|
|
223
|
+
|
|
224
|
+
Local evaluation against your own exported GGUF (requires [Ollama](https://ollama.com)
|
|
225
|
+
with the model installed):
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
python -m rlvr.gguf_eval --model netelpro-qwen1.5b-raft
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
## Status
|
|
233
|
+
- **Spec:** v0.9 consolidated at [`docs/SPEC.md`](docs/SPEC.md); machine-consumed arity table at `spec/arity_table.json`.
|
|
234
|
+
- **Release:** [v0.9.0](https://github.com/jona2428/netelpro/releases/tag/v0.9.0) — RLVR/RAFT run #2 (accumulated pool, paired seeded evals, official `rlvr.gguf_eval`), on top of v0.7.0's HonestyGuard SDK, Verification Theater Benchmark, DPO Colab Trainer, LLVM native JIT, and MCP server. Full history in [`CHANGELOG.md`](CHANGELOG.md).
|
|
235
|
+
- **History:** zero differential divergence between Python interpreter and LLVM native backend across the test suite (see the CI badge above for current pass count — this file no longer hardcodes it, it goes stale every release).
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""Netelpro language package -- Phase 1 compiler frontend.
|
|
2
|
+
|
|
3
|
+
The compiler-as-prosecutor:
|
|
4
|
+
Deterministic lexical analysis, mechanical arity verification against spec/arity_table.json,
|
|
5
|
+
and typed, frozen AST construction with exact source coordinates.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from netelpro.ast_nodes import (
|
|
10
|
+
And,
|
|
11
|
+
BoolLit,
|
|
12
|
+
Call,
|
|
13
|
+
Def,
|
|
14
|
+
Defn,
|
|
15
|
+
FloatLit,
|
|
16
|
+
Fn,
|
|
17
|
+
Grant,
|
|
18
|
+
If,
|
|
19
|
+
IntLit,
|
|
20
|
+
Let,
|
|
21
|
+
ListLit,
|
|
22
|
+
Literal,
|
|
23
|
+
NilLit,
|
|
24
|
+
Node,
|
|
25
|
+
Or,
|
|
26
|
+
ParamType,
|
|
27
|
+
Program,
|
|
28
|
+
Sorry,
|
|
29
|
+
StrLit,
|
|
30
|
+
Sym,
|
|
31
|
+
Symbol,
|
|
32
|
+
TruthTableSpec,
|
|
33
|
+
)
|
|
34
|
+
from netelpro.lexer import (
|
|
35
|
+
LexError,
|
|
36
|
+
Lexer,
|
|
37
|
+
LexerError,
|
|
38
|
+
Tok,
|
|
39
|
+
Token,
|
|
40
|
+
tokenize,
|
|
41
|
+
)
|
|
42
|
+
from netelpro.parser import (
|
|
43
|
+
ParseError,
|
|
44
|
+
ParseResult,
|
|
45
|
+
Parser,
|
|
46
|
+
parse,
|
|
47
|
+
)
|
|
48
|
+
from netelpro.evaluator import (
|
|
49
|
+
StrayError,
|
|
50
|
+
StrayHoleError,
|
|
51
|
+
StrayList,
|
|
52
|
+
StrayRuntimeError,
|
|
53
|
+
Closure,
|
|
54
|
+
Environment,
|
|
55
|
+
eval_node,
|
|
56
|
+
evaluate,
|
|
57
|
+
format_value,
|
|
58
|
+
is_nil,
|
|
59
|
+
run_source,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
__version__ = "0.1.0"
|
|
63
|
+
|
|
64
|
+
__all__ = [
|
|
65
|
+
# Version
|
|
66
|
+
"__version__",
|
|
67
|
+
# Lexer exports
|
|
68
|
+
"Lexer",
|
|
69
|
+
"LexError",
|
|
70
|
+
"LexerError",
|
|
71
|
+
"Tok",
|
|
72
|
+
"Token",
|
|
73
|
+
"tokenize",
|
|
74
|
+
# Parser exports
|
|
75
|
+
"Parser",
|
|
76
|
+
"ParseError",
|
|
77
|
+
"ParseResult",
|
|
78
|
+
"parse",
|
|
79
|
+
# AST Node exports
|
|
80
|
+
"Node",
|
|
81
|
+
"Sym",
|
|
82
|
+
"Symbol",
|
|
83
|
+
"Literal",
|
|
84
|
+
"IntLit",
|
|
85
|
+
"FloatLit",
|
|
86
|
+
"StrLit",
|
|
87
|
+
"BoolLit",
|
|
88
|
+
"NilLit",
|
|
89
|
+
"ListLit",
|
|
90
|
+
"Def",
|
|
91
|
+
"Defn",
|
|
92
|
+
"Fn",
|
|
93
|
+
"Let",
|
|
94
|
+
"If",
|
|
95
|
+
"And",
|
|
96
|
+
"Or",
|
|
97
|
+
"Sorry",
|
|
98
|
+
"Grant",
|
|
99
|
+
"Call",
|
|
100
|
+
"Program",
|
|
101
|
+
"ParamType",
|
|
102
|
+
"TruthTableSpec",
|
|
103
|
+
# Evaluator exports
|
|
104
|
+
"StrayError",
|
|
105
|
+
"StrayRuntimeError",
|
|
106
|
+
"StrayHoleError",
|
|
107
|
+
"StrayList",
|
|
108
|
+
"evaluate",
|
|
109
|
+
"run_source",
|
|
110
|
+
# Evaluator internals (public API for tooling)
|
|
111
|
+
"Closure",
|
|
112
|
+
"Environment",
|
|
113
|
+
"eval_node",
|
|
114
|
+
"format_value",
|
|
115
|
+
"is_nil",
|
|
116
|
+
]
|