Commit 8605482
feat(lang): implement record field access with dot notation (Task #24)
Added complete support for record/struct field access and record literals:
Parser changes:
- Added parse_record_literal() for TypeName { field: value } syntax
- Added Dot token to Call precedence level
- Modified parse_infix() to handle field access (record.field)
- Modified parse_prefix() to detect record literals
TypeChecker changes:
- Changed TypeInfo::Record from HashMap to String (nominal typing)
- Added type_defs field to track struct definitions
- Added type_from_ast() to convert AST types to TypeInfo
- Implemented field access type inference with struct field lookup
- Implemented record literal type checking with field validation
Interpreter changes:
- Added FieldAccess evaluation (looks up field in Record value)
- Added RecordLiteral evaluation (builds HashMap from field expressions)
Linter changes:
- Added linter cases for FieldAccess and RecordLiteral
Other:
- Updated .tool-versions (rust nightly for better tooling)
- Added examples/28_record_fields.woke and examples/29_simple_record.woke
- Created STATE.scm with comprehensive project state tracking
- Added SPDX headers to all source files (PMPL-1.0-or-later)
All examples build and run successfully. Type checking ensures field access
safety and record literal correctness at compile time.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 61a6254 commit 8605482
34 files changed
Lines changed: 1103 additions & 479 deletions
File tree
- benches
- examples
- src
- ast
- codegen
- ffi
- interpreter
- lexer
- linter
- parser
- security
- stdlib
- typechecker
- vm
- worker
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | | - | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
287 | 292 | | |
288 | 293 | | |
289 | 294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
0 commit comments