Skip to content

Comments

AGR: Switch rule definition syntax from '@' prefix to ';' suffix#1944

Merged
curtisman merged 4 commits intomicrosoft:mainfrom
curtisman:grammar
Feb 23, 2026
Merged

AGR: Switch rule definition syntax from '@' prefix to ';' suffix#1944
curtisman merged 4 commits intomicrosoft:mainfrom
curtisman:grammar

Conversation

@curtisman
Copy link
Member

@curtisman curtisman commented Feb 22, 2026

Summary

This PR changes the Action Grammar (AGR) rule definition syntax from using a @ prefix to using a ; suffix as the rule delimiter. The new syntax is cleaner and more conventional, aligning with common grammar formats where statements end with a terminator rather than begin with a sigil.

Before:

@ <Start> = <scheduleEvent> | <findEvents>
@ <scheduleEvent> = 'schedule' $(title:string) 'on' $(date:CalendarDate) -> { actionName: "scheduleEvent", parameters: { title: title, date: date } }

After:

<Start> = <scheduleEvent> | <findEvents>;
<scheduleEvent> = 'schedule' $(title:string) 'on' $(date:CalendarDate) -> { actionName: "scheduleEvent", parameters: { title: title, date: date } };

Note that dynamic grammar cache (the NFA cache) will break, because the grammar stored is textual currently.

Changes

  • Parser (grammarRuleParser.ts): Updated to recognize semicolon-terminated rule definitions instead of @-prefixed ones
  • Writer (grammarRuleWriter.ts): Updated to emit semicolons at the end of rule definitions
  • Schema generator (schemaToGrammarGenerator.ts): Updated all AI prompt examples and CRITICAL SYNTAX RULES to reflect the new format
  • All .agr grammar files: Migrated 25+ agent grammar files across browser, calendar, code, desktop, email, image, list, photo, player, video, and weather agents
  • VSCode extension (agr.tmLanguage.json): Updated syntax highlighting to match the new grammar
  • Test files: Updated all test cases across actionGrammar, agentSdkWrapper, and cache packages
  • Documentation: Updated CONFIGURATION_AND_PERSISTENCE.md with new syntax
  • Generated registry: Updated generatedSchemaRegistry.json with regenerated grammar content using new syntax

Test plan

  • All existing actionGrammar unit tests pass with the new syntax
  • Grammar parsing correctly handles semicolon-terminated rules
  • Grammar writing emits valid semicolon-terminated rules
  • VSCode extension syntax highlighting works for the new format
  • AI-generated grammars from schemaToGrammarGenerator use the new syntax
  • Round-trip serialization/deserialization of grammars works correctly

🤖 Generated with Claude Code

@curtisman curtisman added this pull request to the merge queue Feb 23, 2026
Merged via the queue into microsoft:main with commit 89e3901 Feb 23, 2026
13 of 15 checks passed
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