summaryrefslogtreecommitdiff
path: root/src/main/java/com/seaofnodes/simple/parser/README.md
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-08-10 11:11:18 -0700
committerCliff Click <cliffc@acm.org>2026-11-01 10:33:55 -0800
commitf66ab11456244b12c48ee9231cec5c8b54b47efe (patch)
treeaaf80846f49bad4cc24487306eac7464804513d1 /src/main/java/com/seaofnodes/simple/parser/README.md
parente646e5c534f8c5cbfd2969958cf6f4930e687aeb (diff)
downloadSimple-linear.tar.gz
Simple-linear.zip
Chapter 29: Tech Debt Cleanuplinear-chapter29linear
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: Symious <14933944+symious@users.noreply.github.com> Co-authored-by: Jun Kawasaki <jun784@gmail.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/main/java/com/seaofnodes/simple/parser/README.md')
-rw-r--r--src/main/java/com/seaofnodes/simple/parser/README.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/com/seaofnodes/simple/parser/README.md b/src/main/java/com/seaofnodes/simple/parser/README.md
new file mode 100644
index 00000000..1adc7f33
--- /dev/null
+++ b/src/main/java/com/seaofnodes/simple/parser/README.md
@@ -0,0 +1,26 @@
+# Parser layout
+
+The parser builds Sea-of-Nodes IR directly. Each component shares the cursor,
+active scope, and compilation state through its `Parser P` reference; there is no intermediate
+AST. The [grammar map](../../../../../../../docs/chapter29/29-grammar.md) connects language
+productions to their entry points.
+
+| File | Responsibility |
+| --- | --- |
+| `Parser.java` | Source-unit entry point, shared state, type registry, and common token/IR helpers. |
+| `Lexer.java` | Tokens, literals, comments, source-location snapshots, and scanning deferred bodies. |
+| `Statements.java` | Statement dispatch, blocks, loops, and jumps. |
+| `Expressions.java` | Assignment and expression precedence, unary operators, primaries, and postfix dispatch. |
+| `Declarations.java` | Bindings, initializers, mutability modifiers, and native declarations. |
+| `Types.java` | Type syntax, qualified-name lookup, arrays, function types, and forward types. |
+| `Functions.java` | Function expressions, parameters, arguments, calls, and function entry/return graphs. |
+| `Structs.java` | Struct and constructor declarations, field discovery, and initialization checks. |
+| `References.java` | Bare-name and field resolution, implicit receivers, assignments, and forward references. |
+| `Allocations.java` | Allocation expressions, strings, and declaration-side allocation helpers. |
+| `ControlFlow.java` | Guarded scope merging shared by `if`, `?:`, `&&`, and `||`. |
+| `Conversions.java` | Shared binding, field, and result conversions. |
+| `Var.java` | Lexical binding metadata: name, type, scope slot, mutability, and initialization state. |
+
+Start with `Statements.parseStatement` or `Expressions.parseAssignment` to follow
+the grammar. Loop updates are parsed after their bodies, and declared constructor
+bodies after field discovery; `Lexer.skipTo` scans these deferred fragments.