Skip to content

profile_time(): reserved keyword, statement and expression forms - #14

Merged
revarbat merged 1 commit into
mainfrom
feat/profile-time
Oct 6, 2026
Merged

revarbat merged 1 commit into
mainfrom
feat/profile-time

Conversation

@revarbat

@revarbat revarbat commented Oct 6, 2026

Copy link
Copy Markdown
Member

Parser half of profile_time() (evaluator PR follows).

  • Statement form profile_time(args) children: a plain ModularCall named profile_time, built like render_stmt, so builtin dispatch, the argument allowlist, json_io and the pretty-printer see an ordinary module call.
  • Expression form x = profile_time(args) expr;: new ProfileTimeOp node shaped like EchoOp, body required. Lives in expr like echo/assert/let.
  • profile_time is a reserved keyword (KW_PROFILE_TIME): LALR(1) cannot otherwise tell the expression form from a function call — the same reason as render. $profile_time stays an ordinary identifier.
  • Dispatch added to: NodeKind/kind name, toString/buildScope, operator precedence (0, like EchoOp), json_io (to/from), pretty_print, inline comment attachment.

No new grammar conflicts (%expect unchanged).

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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant