feat(syntax): parse native fn bodies and native blocks #472
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/467-native-body-parser"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #467
Parses the IR body of a
native fnand thenative { }block (docs/design/NATIVE-BODIES.md, section 2.1) with a grammar of its own inparser/natives.trb;intrinsicstays an ordinary name elsewhere. The checker reports "Anativebody is not supported yet" until the checking and lowering steps land.Tests: parser group (accepted examples, exact error messages,
intrinsicas a name,native fnwithout body), checker test, formatter idempotence. CI is the first compile of all of it.A `native fn` may carry an IR body of `const` bindings of operations and a result, each operation written `intrinsic add.i64 left, right`, and an ordinary function may use a `native { }` block as an expression. The body has a grammar of its own (parser/natives.trb), `intrinsic` stays an ordinary name everywhere else. The checker reports "A `native` body is not supported yet" until the later steps of docs/design/NATIVE-BODIES.md check and lower it. Refs #4672c420d0d65ed5f8e22f3ed5f8e22f35587ddd702native fnbodies andnative { }blocks, with a parser gate test (step 2 of #53) #467CI red on
5587ddd:ci / tier A (linux-x64)(and thegatesrollup) - theformat --checklane failed:./tests/language/from-scalar.trb"1 of 1438 files would change". That file is not in this diff and is not onmainat307c159, so it looks like a stale-base artefact (the run was built on57085dc;mainhas since gained achore(format)commit). Every other lane, including bootstrap andtest compiler/tests, was green. Rebase ontomainand re-run; ifformat --checkstill names a file, runtorb formaton it. My review request stays pending and the next CI run brings me back.5587ddd7025210ccaf13CI red on
5210cca:ci / tier A (linux-x64)(and thegatesrollup); every other lane that ran is green (bootstrap, pdisc, playground, same-C, release-sync). I could not read the tier A log with my token, so the lane is not named. The branch is still based on307c159and lacksc854824/a4b0004(thefrom-scalar.trbformat fixes) thatmaingained at 12:46Z; the run started at 12:50Z, so it is likely the sameformat --checkfailure as on5587ddd.mainis now7d5b271. Rebase ontomainand re-run; if tier A still fails, name the failing lane in a comment. A first read of the diff found no blocker: the newNativeBlockarm is covered in every exhaustive match I could see in the diff, and parser, checker and formatter tests are present. My review request stays pending and the next CI run brings me back.5210ccaf134228e5621fCI red on
4228e56:ci / tier A (linux-x64)(and thegatesrollup) failed after 24m19s; every other lane that ran is green (bootstrap, pdisc, playground, same-C, release-sync, commit messages). The branch is now based on currentmain(7d5b271), so this is not the stale-baseformat --checkartefact from the earlier runs, and the PR body notes CI is the first compile of the new parser/checker/formatter code. I cannot read the tier A log with my token, so the failing step is not named. Please look at the tier A log, fix the failure and push; if it is infrastructure-only (runner timeout, flake), re-run the lane and say so here. The diff itself showed no blocker on first read. My review request stays pending and the next CI run brings me back.Tier A on
4228e56failed only informat --check(4 of 1460 files would change):parser/declarations.trb,parser/natives.trb,tests/parser.test.trb,tests/program-shape.test.trb- the parenthesised calls the formatter wants as commands. Rantorb formaton exactly those four files (21 lines, layout only) and pushed9ec48c2on top of currentmain(7d5b271). Re-requesting review.CI red on
9ec48c2:ci / commit messages- the subjectstyle(syntax): run torb format on the native-body parser and its testsis not a Conventional Commit fortools/check-commits.sh:styleis not an allowed type (allowed: feat fix perf refactor docs test build ci chore revert). Tier A, gates, bootstrap, same-C, playground and release-sync are green on this head, so the format fix itself worked. Reword that commit with an allowed type (e.g.chore(syntax): run torb format ...) or fold it into4228e56(the repo lands branches rebased, so a force-push is fine) and push. My review request stays pending and the next CI run brings me back.9ec48c274cf45061f9e6ci / commit messageson9ec48c2: reworded the format commit tochore(syntax): run torb format on the native-body parser and its tests(styleis not an allowed type). Tree is identical to9ec48c2(where tier A and all other lanes were green);tools/check-commits.shpasses locally on origin/main..HEAD. Force-pushedf45061fon top of currentmain(7d5b271). Re-requesting review.Approved on
f45061f(CI green on this head: tier A, gates, bootstrap, same-C, playground, release-sync, commit messages).intrinsicas a name,native fnwithout body), checker tests in program-shape, formatter keeps/idempotence cases. okNativeBlockarm is covered in every exhaustive match in the diff (canon walk, documentation canon, test-tree, unread-binding, nodes, quote, checker).native {is only an expression when{follows, so the modifier path is unchanged;native fnwithout braces keepsbody: None, nativeBody: None. Error recovery returns a placeholder result, so a malformed body does not cascade. okNon-blocking: NATIVE-BODIES.md still says "Nothing of it is in the parser"; update the status line when the slice is marked done.
native fnbodies as IR andnative { }blocks #53native fnbodies as IR andnative { }blocks #53native fnbodies as IR andnative { }blocks #53