go: parse.sx — binary operators via Pratt precedence climbing + 9 tests [consumes-pratt]
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
gp-parse-expr / gp-pratt-loop implement classic Pratt climbing against go-precedence-table (entry shape from lib/guest/pratt.sx). The kit gives us pratt-op-lookup + accessors; the climbing loop itself stays per-language (per kit header — Lua and Prolog have opposite conventions). Left-associative ops raise the right-recursion min by 1; right- associative would keep prec. All Go binary operators are left-assoc. AST shape: a binary node is emitted as (ast-app (ast-var OP) [LHS RHS]) — canonical ast-app rather than a Go-specific binary node, since a future evaluator can recognise operator-named apps without losing information. Coverage: equal-prec left-to-right, * tighter than +, && tighter than ||, comparison tighter than &&, long left-assoc chains, mixed literal+ident operands. parse 26/26, total 155/155. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"language": "go",
|
||||
"total_pass": 146,
|
||||
"total": 146,
|
||||
"total_pass": 155,
|
||||
"total": 155,
|
||||
"suites": [
|
||||
{"name":"lex","pass":129,"total":129,"status":"ok"},
|
||||
{"name":"parse","pass":17,"total":17,"status":"ok"},
|
||||
{"name":"parse","pass":26,"total":26,"status":"ok"},
|
||||
{"name":"types","pass":0,"total":0,"status":"pending"},
|
||||
{"name":"eval","pass":0,"total":0,"status":"pending"},
|
||||
{"name":"runtime","pass":0,"total":0,"status":"pending"},
|
||||
|
||||
Reference in New Issue
Block a user