Skip to content

Comments

Simplify grammar rule variable reference syntax from $(varName) to bare identifiers#1939

Merged
curtisman merged 2 commits intomicrosoft:mainfrom
curtisman:var
Feb 21, 2026
Merged

Simplify grammar rule variable reference syntax from $(varName) to bare identifiers#1939
curtisman merged 2 commits intomicrosoft:mainfrom
curtisman:var

Conversation

@curtisman
Copy link
Member

@curtisman curtisman commented Feb 21, 2026

Summary

  • Simplify variable reference syntax in AGR grammar: Replace the $(varName) syntax in action body value positions with bare identifier syntax (varName). Rule expression still use $(name:Type), but references to those variables in the action body no longer require the $() wrapper.
  • Update parser and writer: grammarRuleParser.ts now parses bare identifiers as variable references in value positions (instead of $(...) tokens), and grammarRuleWriter.ts serializes them without the wrapper.
  • Update all .agr files: All schema files (calendarSchema.agr, desktopSchema.agr, playerSchema.agr, listSchema.agr, browserSchema.agr, etc.) and examples updated to use the new syntax.
  • Update all tests: All test specs updated to reflect the new variable reference syntax and fix a minor edge case (invalid number test adjusted from abc1231abc).

🤖 Generated with Claude Code

…ifiers

Replace the \$(varName) wrapper syntax for variable references in action
body value positions with plain bare identifiers. Pattern capture groups
still use \$(name:Type), but references to those variables in the action
body now use just the identifier name directly. Updates parser, writer,
all .agr schema files, examples, and tests accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@curtisman curtisman enabled auto-merge February 21, 2026 02:25
@curtisman curtisman changed the title Simplify AGR variable reference syntax from $(varName) to bare identifiers Simplify grammar rule variable reference syntax from $(varName) to bare identifiers Feb 21, 2026
@curtisman curtisman added this pull request to the merge queue Feb 21, 2026
Merged via the queue into microsoft:main with commit 9aa6de4 Feb 21, 2026
13 of 15 checks passed
steveluc added a commit that referenced this pull request Feb 21, 2026
) and fix package.json sort order

- grammarGenerator.ts: Update system prompt examples and RuleRHS comments to use bare
  variable identifiers in action body value positions (e.g., "trackName" not "$(trackName)",
  "[artist]" not "[$(artist)]") to match the syntax change from PR #1939
- schemaToGrammarGenerator.ts: Update TimeSpec example from "-> $(t)" to "-> t"
- packages/agents/code/package.json: Fix sort order per npm-package-sort-metadata policy
- packages/commandExecutor/package.json: Fix sort order per npm-package-sort-metadata policy

All 17 grammar test suites pass (352 tests).

Co-Authored-By: Claude Sonnet 4.6 <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