Skip to content

Commit b52742a

Browse files
hyperpolymathclaude
andcommitted
merge: integrate layer1-local-work — AST visitor, specs, conformance, S-expr/JSON
Merges 11 commits from layer1-local-work: - feat: S-expression and JSON AST dump (Layer 1) - feat: AST visitor framework (src/ast/visitor.rs) - test: 25+ conformance tests (total 38) - spec: canonical grammar.ebnf, axiomatic semantics, system specs, spec/README.adoc, verification/README.adoc - fix: SPDX headers, copyright, seam audit - chore: RSR compliance — licence standardisation, workflow fixes Conflict resolutions: - boilerplate (CODE_OF_CONDUCT, CONTRIBUTING, SECURITY): HEAD - conformance/run_conformance.sh: HEAD (array-based, no eval) - interpreter loop context tracking: HEAD - formatter Send/Receive/Await/Cancel: HEAD - spec/verification/ast new files: layer1 content - ocaml-core.yml: canonical SHA pins - .gitignore: HEAD + layer1 extras (wasm, profraw, .Trash-*) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 parents 092ce05 + 1902c5c commit b52742a

7 files changed

Lines changed: 46 additions & 76 deletions

File tree

.github/workflows/ocaml-core.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030

3131
steps:
3232
- name: Checkout repository
33-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
33+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3434

3535
- name: Setup OCaml
36-
uses: ocaml/setup-ocaml@v3
36+
uses: ocaml/setup-ocaml@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3
3737
with:
3838
ocaml-compiler: ${{ matrix.ocaml-version }}
3939
dune-cache: true
@@ -57,10 +57,10 @@ jobs:
5757

5858
steps:
5959
- name: Checkout repository
60-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
60+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
6161

6262
- name: Setup OCaml
63-
uses: ocaml/setup-ocaml@v3
63+
uses: ocaml/setup-ocaml@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3
6464
with:
6565
ocaml-compiler: '5.1.0'
6666
dune-cache: true

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,17 @@ ai-cli-crash-capture/
6363
*.glob
6464
.*.aux
6565
editors/vscode/lib/
66+
67+
# Native build artifacts
68+
*.wasm
69+
*.so
70+
*.dylib
71+
*.dll
72+
73+
# Coverage / profiling
74+
*.profraw
75+
*.profdata
76+
.coverage/
77+
78+
# OS
79+
.Trash-*/

spec/README.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- SPDX-License-Identifier: PMPL-1.0-or-later -->
21
// SPDX-License-Identifier: PMPL-1.0-or-later
32
// @taxonomy: spec/index
43
= wokelang — Specification Directory

spec/axiomatic-semantics.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- SPDX-License-Identifier: PMPL-1.0-or-later -->
21
# SPDX-License-Identifier: PMPL-1.0-or-later
32
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
43

spec/system-specs.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- SPDX-License-Identifier: PMPL-1.0-or-later -->
21
# SPDX-License-Identifier: PMPL-1.0-or-later
32
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
43

src/ast/visitor.rs

Lines changed: 28 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,13 @@ use super::*;
88
/// Trait for visiting WokeLang AST nodes.
99
pub trait Visitor: Sized {
1010
fn visit_program(&mut self, program: &Program) {
11-
for item in &program.items {
12-
self.visit_top_level_item(item);
13-
}
11+
for item in &program.items { self.visit_top_level_item(item); }
1412
}
1513
fn visit_top_level_item(&mut self, item: &TopLevelItem) {
1614
walk_top_level_item(self, item);
1715
}
18-
fn visit_statement(&mut self, stmt: &Statement) {
19-
walk_statement(self, stmt);
20-
}
21-
fn visit_expr(&mut self, expr: &Expr) {
22-
walk_expr(self, expr);
23-
}
16+
fn visit_statement(&mut self, stmt: &Statement) { walk_statement(self, stmt); }
17+
fn visit_expr(&mut self, expr: &Expr) { walk_expr(self, expr); }
2418
fn visit_pattern(&mut self, _pattern: &Pattern) {}
2519
fn visit_function_def(&mut self, func: &FunctionDef) {
2620
walk_function_def(self, func);
@@ -31,35 +25,26 @@ pub fn walk_top_level_item<V: Visitor>(v: &mut V, item: &TopLevelItem) {
3125
match item {
3226
TopLevelItem::Function(f) => v.visit_function_def(f),
3327
TopLevelItem::ConsentBlock(c) => {
34-
for stmt in &c.body {
35-
v.visit_statement(stmt);
36-
}
28+
for stmt in &c.body { v.visit_statement(stmt); }
3729
}
3830
TopLevelItem::GratitudeDecl(_) => {}
3931
TopLevelItem::WorkerDef(w) => {
40-
for stmt in &w.body {
41-
v.visit_statement(stmt);
42-
}
32+
for stmt in &w.body { v.visit_statement(stmt); }
4333
}
4434
TopLevelItem::SideQuestDef(s) => {
45-
for stmt in &s.body {
46-
v.visit_statement(stmt);
47-
}
35+
for stmt in &s.body { v.visit_statement(stmt); }
4836
}
4937
TopLevelItem::SuperpowerDecl(s) => {
50-
for stmt in &s.body {
51-
v.visit_statement(stmt);
52-
}
38+
for stmt in &s.body { v.visit_statement(stmt); }
5339
}
54-
TopLevelItem::ModuleImport(_) | TopLevelItem::Pragma(_) | TopLevelItem::TypeDef(_) => {}
40+
TopLevelItem::ModuleImport(_) | TopLevelItem::Pragma(_)
41+
| TopLevelItem::TypeDef(_) => {}
5542
TopLevelItem::ConstDef(c) => v.visit_expr(&c.value.node),
5643
}
5744
}
5845

5946
pub fn walk_function_def<V: Visitor>(v: &mut V, func: &FunctionDef) {
60-
for stmt in &func.body {
61-
v.visit_statement(stmt);
62-
}
47+
for stmt in &func.body { v.visit_statement(stmt); }
6348
}
6449

6550
pub fn walk_statement<V: Visitor>(v: &mut V, stmt: &Statement) {
@@ -69,51 +54,34 @@ pub fn walk_statement<V: Visitor>(v: &mut V, stmt: &Statement) {
6954
Statement::Return(r) => v.visit_expr(&r.value.node),
7055
Statement::Conditional(c) => {
7156
v.visit_expr(&c.condition.node);
72-
for s in &c.then_branch {
73-
v.visit_statement(s);
74-
}
57+
for s in &c.then_branch { v.visit_statement(s); }
7558
if let Some(eb) = &c.else_branch {
76-
for s in eb {
77-
v.visit_statement(s);
78-
}
59+
for s in eb { v.visit_statement(s); }
7960
}
8061
}
8162
Statement::Loop(l) => {
8263
v.visit_expr(&l.count.node);
83-
for s in &l.body {
84-
v.visit_statement(s);
85-
}
64+
for s in &l.body { v.visit_statement(s); }
8665
}
8766
Statement::While(w) => {
8867
v.visit_expr(&w.condition.node);
89-
for s in &w.body {
90-
v.visit_statement(s);
91-
}
68+
for s in &w.body { v.visit_statement(s); }
9269
}
9370
Statement::AttemptBlock(a) => {
94-
for s in &a.body {
95-
v.visit_statement(s);
96-
}
71+
for s in &a.body { v.visit_statement(s); }
9772
}
9873
Statement::ConsentBlock(c) => {
99-
for s in &c.body {
100-
v.visit_statement(s);
101-
}
74+
for s in &c.body { v.visit_statement(s); }
10275
}
10376
Statement::Expression(e) => v.visit_expr(&e.node),
10477
Statement::WorkerSpawn(_) | Statement::Complain(_)
105-
| Statement::Break(_) | Statement::Continue(_)
106-
| Statement::ReceiveMessage(_) | Statement::AwaitWorker(_)
107-
| Statement::CancelWorker(_) => {}
108-
Statement::SendMessage(s) => v.visit_expr(&s.message.node),
78+
| Statement::Break(_) | Statement::Continue(_) => {}
10979
Statement::EmoteAnnotated(e) => v.visit_statement(&e.statement),
11080
Statement::Decide(d) => {
11181
v.visit_expr(&d.scrutinee.node);
11282
for arm in &d.arms {
11383
v.visit_pattern(&arm.pattern);
114-
for s in &arm.body {
115-
v.visit_statement(s);
116-
}
84+
for s in &arm.body { v.visit_statement(s); }
11785
}
11886
}
11987
}
@@ -128,21 +96,15 @@ pub fn walk_expr<V: Visitor>(v: &mut V, expr: &Expr) {
12896
}
12997
Expr::Unary(_, operand) => v.visit_expr(&operand.node),
13098
Expr::Call(_, args) => {
131-
for arg in args {
132-
v.visit_expr(&arg.node);
133-
}
99+
for arg in args { v.visit_expr(&arg.node); }
134100
}
135101
Expr::CallExpr(callee, args) => {
136102
v.visit_expr(&callee.node);
137-
for arg in args {
138-
v.visit_expr(&arg.node);
139-
}
103+
for arg in args { v.visit_expr(&arg.node); }
140104
}
141105
Expr::UnitMeasurement(inner, _) => v.visit_expr(&inner.node),
142106
Expr::Array(elems) => {
143-
for e in elems {
144-
v.visit_expr(&e.node);
145-
}
107+
for e in elems { v.visit_expr(&e.node); }
146108
}
147109
Expr::Index(arr, idx) => {
148110
v.visit_expr(&arr.node);
@@ -151,19 +113,17 @@ pub fn walk_expr<V: Visitor>(v: &mut V, expr: &Expr) {
151113
Expr::Okay(inner) | Expr::Oops(inner) | Expr::Unwrap(inner) => {
152114
v.visit_expr(&inner.node);
153115
}
154-
Expr::Lambda(lam) => match &lam.body {
155-
LambdaBody::Expr(e) => v.visit_expr(&e.node),
156-
LambdaBody::Block(stmts) => {
157-
for s in stmts {
158-
v.visit_statement(s);
116+
Expr::Lambda(lam) => {
117+
match &lam.body {
118+
LambdaBody::Expr(e) => v.visit_expr(&e.node),
119+
LambdaBody::Block(stmts) => {
120+
for s in stmts { v.visit_statement(s); }
159121
}
160122
}
161-
},
123+
}
162124
Expr::FieldAccess(obj, _) => v.visit_expr(&obj.node),
163125
Expr::RecordLiteral(_, fields) => {
164-
for (_, val) in fields {
165-
v.visit_expr(&val.node);
166-
}
126+
for (_, val) in fields { v.visit_expr(&val.node); }
167127
}
168128
}
169129
}

verification/README.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- SPDX-License-Identifier: PMPL-1.0-or-later -->
21
// SPDX-License-Identifier: PMPL-1.0-or-later
32
// @taxonomy: verification/index
43
= wokelang — Verification Directory

0 commit comments

Comments
 (0)