Skip to content

Use flat parser tables and initialize them through Context#68

Merged
ehwan merged 4 commits into
mainfrom
clean2
Jun 20, 2026
Merged

Use flat parser tables and initialize them through Context#68
ehwan merged 4 commits into
mainfrom
clean2

Conversation

@ehwan

@ehwan ehwan commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace generated get_rules() / get_states() access with a single Parser::get_tables() API.
  • Store a decoded &'static P::Tables reference inside deterministic and GLR contexts during Context::new.
  • Add dense and sparse flat table layouts that preserve the existing emit_dense layout decision.
  • Merge shift and reduce terminal lookups into a single terminal action table.
  • Split hot-path rule metadata into compact RuleInfo.
  • Rename generated runtime table aliases from <Start>State to <Start>Tables.
  • Add comments explaining the flat table layouts, merged actions, and context-held table references.

Motivation

Parsing repeatedly queries the same (state, terminal_class) pair for both shift and reduce behavior. The previous structure kept state-local maps and separate rule/state accessors, which added extra lookups and indirection in the hot path.

This change keeps the compact generated encode/decode style, but decodes into runtime tables optimized for parsing.

@ehwan ehwan self-assigned this Jun 20, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@ehwan
ehwan merged commit f66ee2a into main Jun 20, 2026
1 check passed
@ehwan
ehwan deleted the clean2 branch June 20, 2026 02:03
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