Repository navigation
profile_time(): reserved keyword, statement and expression forms - #14
Merged
Merged
Conversation
Statement form 'profile_time(args) children' is a plain ModularCall named profile_time, like render_stmt, so builtin dispatch downstream is unchanged. Expression form 'profile_time(args) expr' is a new ProfileTimeOp node shaped like EchoOp, with a required body. The keyword exists only because LALR(1) cannot otherwise tell the expression form from a function call. Added to json_io, pretty_print, comment attachment, operator precedence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 6, 2026
This was referenced Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parser half of
profile_time()(evaluator PR follows).profile_time(args) children: a plainModularCallnamedprofile_time, built likerender_stmt, so builtin dispatch, the argument allowlist, json_io and the pretty-printer see an ordinary module call.x = profile_time(args) expr;: newProfileTimeOpnode shaped likeEchoOp, body required. Lives inexprlike echo/assert/let.profile_timeis a reserved keyword (KW_PROFILE_TIME): LALR(1) cannot otherwise tell the expression form from a function call — the same reason asrender.$profile_timestays an ordinary identifier.NodeKind/kind name,toString/buildScope, operator precedence (0, like EchoOp), json_io (to/from), pretty_print, inline comment attachment.No new grammar conflicts (
%expectunchanged).Tests:
tests/test_profile_time.cpp(8): statement form is a ModularCall, expression form wraps its body, label optional, body required, keyword reserved, toString/JSON/pretty-print round-trip. Full suite 669/669.🤖 Generated with Claude Code