Remove %trace directive and runtime tracing functionality#60
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the %trace feature and its associated functionality across the codebase. This includes removing the trace method from both deterministic and nondeterministic parser contexts, deleting the is_trace method from the NonTerminal trait, and cleaning up the parser, lexer, grammar definitions, and documentation that supported tracing non-terminals. I have no feedback to provide as there are no review comments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Description
This PR removes the
%tracedirective, theis_tracetrait method, and thecontext.trace()runtime diagnostics from the parser core and generator.Motivation
The
%traceoption has seen little practical utility for parsing diagnostics in standard applications. Furthermore, marking non-terminals with%traceprevents the optimization engine from applying key optimizations (such as Unit Production Elimination), resulting in larger parser tables and binary sizes. Removing%tracesimplifies the codebase and allows more aggressive optimizations across all non-terminal symbols.Key Changes
1.
rusty_lr_core(Runtime)is_tracemethod from theNonTerminaltrait innonterminal.rs.pub fn trace(&self)and associated helper implementations from both the deterministic (deterministic/context.rs) and nondeterministic (nondeterministic/context.rs) parser contexts.2.
rusty_lr_parser(Parser Generator)%tracedirective inparser.rsand theLexed::Tracetoken type inlexer.rs.is_tracetrait implementation inemit.rs.NonTerminalInfostruct to remove thetracefield, updating all initializations ingrammar.rsandpattern.rs.3. Bootstrap & Testing
parser_expanded.rsand the regression diff files (calculator.rs,calculator_u8.rs,json.rs) with the updated compiler.4. Documentation
context.trace()fromREADME.md.SYNTAX.md.