Skip to content

Fix parser to accept keyword identifiers in parameter names#30

Draft
cto-new[bot] wants to merge 1 commit intomainfrom
fix-grey-lexer-tokenization-empty-stream
Draft

Fix parser to accept keyword identifiers in parameter names#30
cto-new[bot] wants to merge 1 commit intomainfrom
fix-grey-lexer-tokenization-empty-stream

Conversation

@cto-new
Copy link
Copy Markdown

@cto-new cto-new Bot commented Dec 18, 2025

Summary

Fixes a parser bug where keyword tokens (e.g., 'event') could not be used as parameter names, causing a parse error. The parser now treats certain keyword tokens as identifiers in parameter-position contexts, enabling valid Grey code.

Details

  • Update consume_identifier to map keyword tokens to their literal strings when used as identifiers (e.g., Event -> "event").
  • Preserve existing error reporting for non-identifier tokens.
  • Validate with end-to-end tests on core examples (sir_demo.grey, logistics.grey) and ensure no (0,0) errors.
  • Remove debug instrumentation to stabilize release.

Fixes a parser bug where keywords used as identifiers caused 'Expected parameter name' at (0,0). The parser now maps certain keyword tokens to their literal strings during identifier consumption, enabling valid code such as handle_infection(event: Infection).
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.

0 participants