ibex 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +95 -272
- data/docs/architecture.md +187 -35
- data/docs/bison-import.md +103 -0
- data/docs/comparison-policy.md +127 -0
- data/docs/configuration-model.md +59 -0
- data/docs/configuration-report.md +28 -0
- data/docs/conflict-explanation-reviews/v1/records/README.md +28 -0
- data/docs/conflict-explanation-study.md +62 -0
- data/docs/construction-profiling.md +157 -0
- data/docs/cst-migration.md +3 -4
- data/docs/cst.md +24 -0
- data/docs/decisions/0000-template.md +24 -0
- data/docs/decisions/0001-separate-ir-pipeline.md +34 -0
- data/docs/decisions/0002-opaque-user-code-boundary.md +32 -0
- data/docs/decisions/0003-self-hosted-grammar-frontend.md +32 -0
- data/docs/decisions/0004-shared-semantic-and-lossless-source-model.md +33 -0
- data/docs/decisions/0005-contained-grammar-composition.md +34 -0
- data/docs/decisions/0006-bounded-structural-grammar-lowering.md +32 -0
- data/docs/decisions/0007-shared-parser-construction-pipeline.md +33 -0
- data/docs/decisions/0008-versioned-runtime-package-boundary.md +36 -0
- data/docs/decisions/0009-isolated-parser-sessions.md +34 -0
- data/docs/decisions/0010-committed-runtime-observation.md +34 -0
- data/docs/decisions/0011-versioned-semantic-action-boundary.md +37 -0
- data/docs/decisions/0012-bounded-nonexecuting-analysis.md +37 -0
- data/docs/decisions/0013-transactional-generation-publication.md +37 -0
- data/docs/decisions/0014-versioned-generated-lexer.md +35 -0
- data/docs/decisions/0015-worker-isolated-browser-analysis.md +32 -0
- data/docs/decisions/0016-red-green-concrete-syntax.md +34 -0
- data/docs/decisions/0017-persistent-syntax-artifacts.md +35 -0
- data/docs/decisions/0018-conservative-incremental-syntax-reuse.md +38 -0
- data/docs/decisions/0019-runtime-syntax-session-boundary.md +51 -0
- data/docs/decisions/0020-grammar-ir-parser-contract.md +65 -0
- data/docs/decisions/0021-data-only-parser-table-sidecar.md +50 -0
- data/docs/decisions/0022-manifest-bound-verification-report.md +77 -0
- data/docs/decisions/0023-syntax-only-repair-results.md +48 -0
- data/docs/decisions/0024-direct-ielr-construction.md +42 -0
- data/docs/decisions/README.md +74 -0
- data/docs/declarative-configuration.md +262 -0
- data/docs/development.md +179 -2
- data/docs/direct-ielr-decision.md +120 -0
- data/docs/direct-multi-entry-decision.md +82 -0
- data/docs/editor-setup.md +2 -1
- data/docs/error-ux-review-rubric-v1.md +117 -0
- data/docs/error-ux-reviews/v1/records/README.md +22 -0
- data/docs/error-ux-round2-review-status-v1.json +27 -0
- data/docs/error-ux-round2-reviews/v1/records/README.md +30 -0
- data/docs/error-ux-round2-v1.json +1581 -0
- data/docs/error-ux-round2.md +111 -0
- data/docs/error-ux.md +54 -0
- data/docs/getting-started.md +80 -0
- data/docs/grammar-reference.md +184 -13
- data/docs/ielr-design.md +43 -0
- data/docs/ielr.md +92 -0
- data/docs/ja/bison-import.md +51 -0
- data/docs/ja/stable-api.md +53 -0
- data/docs/lexer-construction-profile.md +109 -0
- data/docs/lexer-migration.md +5 -0
- data/docs/maturity.md +128 -0
- data/docs/project-site-strategy.md +54 -0
- data/docs/racc-migration-evidence.md +45 -0
- data/docs/racc-migration.md +11 -0
- data/docs/release-readiness.md +126 -68
- data/docs/repair-semantics.md +123 -0
- data/docs/runtime-abi-evolution.md +307 -0
- data/docs/stability.md +144 -34
- data/docs/status.md +43 -0
- data/docs/syntax-sessions.md +183 -0
- data/docs/table-artifact.md +125 -0
- data/docs/test-interactions.md +219 -0
- data/docs/verification-report.md +137 -0
- data/docs/verifier-trust-boundary.md +199 -0
- data/docs/workloads.md +132 -0
- data/lib/ibex/analysis/digraph.rb +128 -0
- data/lib/ibex/analysis.rb +1 -0
- data/lib/ibex/bison_import/importer.rb +516 -0
- data/lib/ibex/bison_import/tokenizer.rb +260 -0
- data/lib/ibex/bison_import.rb +200 -0
- data/lib/ibex/bounded_subprocess.rb +171 -0
- data/lib/ibex/cli/ambiguity.rb +14 -5
- data/lib/ibex/cli/analysis.rb +134 -0
- data/lib/ibex/cli/bison_import.rb +121 -0
- data/lib/ibex/cli/config.rb +128 -0
- data/lib/ibex/cli/diagnostics.rb +31 -11
- data/lib/ibex/cli/documentation.rb +11 -8
- data/lib/ibex/cli/equiv.rb +169 -0
- data/lib/ibex/cli/error_messages.rb +11 -4
- data/lib/ibex/cli/explain.rb +14 -5
- data/lib/ibex/cli/fix.rb +203 -0
- data/lib/ibex/cli/formatting.rb +11 -10
- data/lib/ibex/cli/fuzz.rb +200 -0
- data/lib/ibex/cli/fuzz_regressions.rb +145 -0
- data/lib/ibex/cli/generation_artifacts.rb +53 -2
- data/lib/ibex/cli/generation_error_messages.rb +1 -1
- data/lib/ibex/cli/grammar_tests.rb +32 -14
- data/lib/ibex/cli/ir_tools.rb +5 -61
- data/lib/ibex/cli/outputs.rb +60 -33
- data/lib/ibex/cli/reduce.rb +202 -0
- data/lib/ibex/cli/reduce_reporting.rb +71 -0
- data/lib/ibex/cli/samples.rb +49 -23
- data/lib/ibex/cli/verify.rb +116 -0
- data/lib/ibex/cli/watch.rb +6 -5
- data/lib/ibex/cli.rb +357 -56
- data/lib/ibex/codegen/action_locations.rb +1 -1
- data/lib/ibex/codegen/action_method_source.rb +5 -6
- data/lib/ibex/codegen/action_source.rb +3 -2
- data/lib/ibex/codegen/ambiguity.rb +5 -4
- data/lib/ibex/codegen/explain.rb +123 -55
- data/lib/ibex/codegen/generated_action_abi.rb +10 -5
- data/lib/ibex/codegen/rbs.rb +15 -7
- data/lib/ibex/codegen/report.rb +25 -13
- data/lib/ibex/codegen/ruby.rb +28 -64
- data/lib/ibex/codegen/ruby_actions.rb +9 -6
- data/lib/ibex/codegen/ruby_syntax.rb +15 -9
- data/lib/ibex/configuration/analysis_grammar.rb +35 -0
- data/lib/ibex/configuration/explanation.rb +421 -0
- data/lib/ibex/configuration/inspector.rb +232 -0
- data/lib/ibex/configuration.rb +580 -0
- data/lib/ibex/coverage/collector.rb +21 -11
- data/lib/ibex/coverage/event_stream.rb +13 -7
- data/lib/ibex/coverage/report.rb +26 -18
- data/lib/ibex/coverage/runtime_event_validator.rb +30 -21
- data/lib/ibex/delta_reducer.rb +99 -0
- data/lib/ibex/diff.rb +140 -0
- data/lib/ibex/equiv/machine.rb +135 -0
- data/lib/ibex/equiv.rb +373 -0
- data/lib/ibex/fix.rb +557 -0
- data/lib/ibex/frontend/ast.rb +22 -2
- data/lib/ibex/frontend/bootstrap_parser.rb +6 -13
- data/lib/ibex/frontend/diagnostic.rb +1 -1
- data/lib/ibex/frontend/formatter.rb +72 -26
- data/lib/ibex/frontend/generated_parser.rb +147 -117
- data/lib/ibex/frontend/generated_parser_base.rb +7 -3
- data/lib/ibex/frontend/generated_parser_includes.rb +1 -11
- data/lib/ibex/frontend/generation.rb +1 -1
- data/lib/ibex/frontend/parser/declarations.rb +17 -2
- data/lib/ibex/frontend/parser_configuration_support.rb +56 -0
- data/lib/ibex/frontend/regenerator.rb +1 -0
- data/lib/ibex/frontend/resolution.rb +2 -1
- data/lib/ibex/frontend/resolver.rb +1 -1
- data/lib/ibex/frontend/rule_documentation.rb +2 -1
- data/lib/ibex/frontend/source_cursor.rb +2 -2
- data/lib/ibex/frontend/source_span.rb +9 -1
- data/lib/ibex/frontend/token_adapter/declaration_state.rb +38 -6
- data/lib/ibex/frontend/token_adapter.rb +10 -0
- data/lib/ibex/frontend.rb +1 -0
- data/lib/ibex/fuzz.rb +219 -0
- data/lib/ibex/generation_input.rb +1 -1
- data/lib/ibex/generation_manifest.rb +36 -25
- data/lib/ibex/generation_transaction.rb +1 -1
- data/lib/ibex/generation_transaction_recovery.rb +4 -4
- data/lib/ibex/generation_transaction_validation.rb +2 -2
- data/lib/ibex/grammar_tests.rb +1 -1
- data/lib/ibex/ir/automaton_ir.rb +61 -19
- data/lib/ibex/ir/grammar_ir.rb +76 -45
- data/lib/ibex/ir/lexer_ir.rb +5 -5
- data/lib/ibex/ir/parser_contract.rb +135 -0
- data/lib/ibex/ir/serialize.rb +203 -76
- data/lib/ibex/ir/validator/automaton.rb +64 -34
- data/lib/ibex/ir/validator/base.rb +51 -33
- data/lib/ibex/ir/validator/grammar.rb +113 -83
- data/lib/ibex/ir/validator/lexer.rb +2 -2
- data/lib/ibex/ir/validator.rb +2 -1
- data/lib/ibex/ir.rb +16 -3
- data/lib/ibex/lalr/build_metrics.rb +50 -2
- data/lib/ibex/lalr/builder.rb +191 -56
- data/lib/ibex/lalr/conflict_search.rb +15 -4
- data/lib/ibex/lalr/counterexample.rb +19 -14
- data/lib/ibex/lalr/direct_lookaheads.rb +110 -57
- data/lib/ibex/lalr/goto_follows.rb +229 -0
- data/lib/ibex/lalr/ielr/annotator.rb +214 -0
- data/lib/ibex/lalr/ielr/bits.rb +28 -0
- data/lib/ibex/lalr/ielr/inadequacy.rb +47 -0
- data/lib/ibex/lalr/ielr/item_lookaheads.rb +78 -0
- data/lib/ibex/lalr/ielr/pipeline.rb +75 -0
- data/lib/ibex/lalr/ielr/split_stability.rb +78 -0
- data/lib/ibex/lalr/ielr/split_state.rb +20 -0
- data/lib/ibex/lalr/ielr/state_splitter.rb +258 -0
- data/lib/ibex/lalr/ielr_partition.rb +22 -8
- data/lib/ibex/lalr/inadequacy_report.rb +50 -0
- data/lib/ibex/lalr/lookahead_propagation.rb +111 -0
- data/lib/ibex/lalr/lr0_collection.rb +121 -0
- data/lib/ibex/lalr/unreachable_states.rb +80 -0
- data/lib/ibex/lalr.rb +52 -1
- data/lib/ibex/location.rb +3 -3
- data/lib/ibex/lsp/document_handlers.rb +9 -7
- data/lib/ibex/lsp/initialization_handlers.rb +9 -7
- data/lib/ibex/lsp/navigation_handlers.rb +25 -11
- data/lib/ibex/lsp/parser_configuration_assistance.rb +149 -0
- data/lib/ibex/lsp/position_codec.rb +6 -2
- data/lib/ibex/lsp/request_handlers.rb +3 -2
- data/lib/ibex/lsp/request_support.rb +14 -7
- data/lib/ibex/lsp/server.rb +13 -11
- data/lib/ibex/lsp/symbol_index.rb +13 -13
- data/lib/ibex/lsp/symbol_index_builder.rb +30 -20
- data/lib/ibex/lsp/symbol_occurrence.rb +8 -2
- data/lib/ibex/lsp/transport.rb +13 -3
- data/lib/ibex/lsp/workspace.rb +5 -4
- data/lib/ibex/lsp/workspace_analyzer.rb +1 -1
- data/lib/ibex/lsp.rb +1 -0
- data/lib/ibex/messages/en.yml +28 -0
- data/lib/ibex/messages/ja.yml +28 -0
- data/lib/ibex/messages.rb +68 -0
- data/lib/ibex/metrics.rb +175 -0
- data/lib/ibex/normalize/declarations.rb +2 -0
- data/lib/ibex/normalize/diagnostics.rb +63 -38
- data/lib/ibex/normalize/expander.rb +5 -4
- data/lib/ibex/normalize/expression.rb +8 -6
- data/lib/ibex/normalize/grammar_builder.rb +26 -0
- data/lib/ibex/normalize/inline_expansion.rb +100 -49
- data/lib/ibex/normalize/lexer.rb +3 -3
- data/lib/ibex/normalize/parameter_ebnf_lowering.rb +11 -10
- data/lib/ibex/normalize/parameter_lowering.rb +40 -23
- data/lib/ibex/normalize/parameters.rb +31 -4
- data/lib/ibex/normalize/parser_configuration.rb +70 -0
- data/lib/ibex/normalize.rb +10 -20
- data/lib/ibex/racc_migration/report.rb +6 -3
- data/lib/ibex/rake_task.rb +1 -1
- data/lib/ibex/samples.rb +43 -13
- data/lib/ibex/table_artifact/builder.rb +266 -0
- data/lib/ibex/table_artifact/cst_projection.rb +70 -0
- data/lib/ibex/table_artifact/document.rb +39 -0
- data/lib/ibex/table_artifact/executor.rb +187 -0
- data/lib/ibex/table_artifact/serializer.rb +57 -0
- data/lib/ibex/table_artifact/validator/metadata.rb +179 -0
- data/lib/ibex/table_artifact/validator/support.rb +86 -0
- data/lib/ibex/table_artifact/validator/tables.rb +238 -0
- data/lib/ibex/table_artifact/validator.rb +253 -0
- data/lib/ibex/table_artifact.rb +88 -0
- data/lib/ibex/table_simulation/result.rb +6 -2
- data/lib/ibex/table_simulation/step.rb +3 -1
- data/lib/ibex/tables.rb +14 -0
- data/lib/ibex/verifiable_generation_bundle.rb +86 -0
- data/lib/ibex/verification_report/builder.rb +159 -0
- data/lib/ibex/verification_report/canonical_ir.rb +123 -0
- data/lib/ibex/verification_report/logical_path.rb +68 -0
- data/lib/ibex/verification_report/validator.rb +329 -0
- data/lib/ibex/verification_report.rb +69 -0
- data/lib/ibex/verify/action_correspondence.rb +138 -0
- data/lib/ibex/verify/language_witness.rb +295 -0
- data/lib/ibex/verify/reference_collection.rb +190 -0
- data/lib/ibex/verify/result.rb +73 -0
- data/lib/ibex/verify/verifier.rb +598 -0
- data/lib/ibex/verify.rb +15 -0
- data/lib/ibex/version.rb +1 -1
- data/lib/ibex/watch/runner.rb +10 -1
- data/lib/ibex/watch/source_snapshot.rb +13 -8
- data/lib/ibex.rb +10 -0
- data/schema/{automaton-ir-v1.schema.json → automaton-ir-definitions.schema.json} +6 -6
- data/schema/{automaton-ir-v2.schema.json → automaton-ir.schema.json} +14 -7
- data/schema/bison-import-v1.schema.json +106 -0
- data/schema/conflict-explanation-review-v1.schema.json +196 -0
- data/schema/conflict-explanation-study-v1.schema.json +528 -0
- data/schema/construction-profile-v1.schema.json +779 -0
- data/schema/diff-v1.schema.json +41 -0
- data/schema/direct-ielr-decision-v1.schema.json +200 -0
- data/schema/equiv-v1.schema.json +64 -0
- data/schema/error-ux-review-v1.schema.json +609 -0
- data/schema/error-ux-round2-review-v1.schema.json +191 -0
- data/schema/error-ux-round2-v1.schema.json +519 -0
- data/schema/explain-v1.schema.json +63 -1
- data/schema/fix-v1.schema.json +64 -0
- data/schema/fix-v2.schema.json +66 -0
- data/schema/fix-v3.schema.json +101 -0
- data/schema/fuzz-regression-v1.schema.json +79 -0
- data/schema/fuzz-v1.schema.json +114 -0
- data/schema/{grammar-ir-v2.schema.json → grammar-ir-extensions.schema.json} +20 -65
- data/schema/{grammar-ir-v1.schema.json → grammar-ir-foundation.schema.json} +3 -3
- data/schema/grammar-ir.schema.json +271 -0
- data/schema/ielr-benchmark-v1.schema.json +85 -0
- data/schema/lexer-profile-v1.schema.json +491 -0
- data/schema/metrics-v1.schema.json +60 -0
- data/schema/reduce-v1.schema.json +22 -0
- data/schema/reduce-v2.schema.json +63 -0
- data/schema/table-artifact-v1.schema.json +377 -0
- data/schema/verification-report-v1.schema.json +222 -0
- data/schema/verify-v1.schema.json +42 -0
- data/sig/ibex/analysis/digraph.rbs +19 -0
- data/sig/ibex/bison_import/importer.rbs +140 -0
- data/sig/ibex/bison_import/tokenizer.rbs +91 -0
- data/sig/ibex/bison_import.rbs +95 -0
- data/sig/ibex/bounded_subprocess.rbs +76 -0
- data/sig/ibex/cli/ambiguity.rbs +6 -0
- data/sig/ibex/cli/analysis.rbs +43 -0
- data/sig/ibex/cli/bison_import.rbs +32 -0
- data/sig/ibex/cli/config.rbs +35 -0
- data/sig/ibex/cli/diagnostics.rbs +16 -3
- data/sig/ibex/cli/documentation.rbs +5 -1
- data/sig/ibex/cli/equiv.rbs +49 -0
- data/sig/ibex/cli/error_messages.rbs +6 -0
- data/sig/ibex/cli/explain.rbs +6 -0
- data/sig/ibex/cli/fix.rbs +53 -0
- data/sig/ibex/cli/formatting.rbs +5 -1
- data/sig/ibex/cli/fuzz.rbs +47 -0
- data/sig/ibex/cli/fuzz_regressions.rbs +40 -0
- data/sig/ibex/cli/generation_artifacts.rbs +21 -2
- data/sig/ibex/cli/generation_error_messages.rbs +2 -2
- data/sig/ibex/cli/grammar_tests.rbs +15 -3
- data/sig/ibex/cli/ir_tools.rbs +7 -19
- data/sig/ibex/cli/outputs.rbs +9 -3
- data/sig/ibex/cli/reduce.rbs +60 -0
- data/sig/ibex/cli/reduce_reporting.rbs +27 -0
- data/sig/ibex/cli/samples.rbs +8 -0
- data/sig/ibex/cli/verify.rbs +28 -0
- data/sig/ibex/cli/watch.rbs +2 -2
- data/sig/ibex/cli.rbs +79 -5
- data/sig/ibex/codegen/action_method_source.rbs +4 -4
- data/sig/ibex/codegen/explain.rbs +45 -25
- data/sig/ibex/codegen/generated_action_abi.rbs +14 -10
- data/sig/ibex/codegen/rbs.rbs +12 -10
- data/sig/ibex/codegen/report.rbs +12 -12
- data/sig/ibex/codegen/ruby.rbs +18 -15
- data/sig/ibex/codegen/ruby_actions.rbs +6 -6
- data/sig/ibex/codegen/ruby_syntax.rbs +10 -8
- data/sig/ibex/configuration/analysis_grammar.rbs +13 -0
- data/sig/ibex/configuration/explanation.rbs +195 -0
- data/sig/ibex/configuration/inspector.rbs +53 -0
- data/sig/ibex/configuration.rbs +242 -0
- data/sig/ibex/coverage/collector.rbs +16 -14
- data/sig/ibex/coverage/event_stream.rbs +12 -10
- data/sig/ibex/coverage/report.rbs +20 -18
- data/sig/ibex/coverage/runtime_event_validator.rbs +38 -36
- data/sig/ibex/delta_reducer.rbs +38 -0
- data/sig/ibex/diff.rbs +47 -0
- data/sig/ibex/equiv/machine.rbs +54 -0
- data/sig/ibex/equiv.rbs +129 -0
- data/sig/ibex/fix.rbs +138 -0
- data/sig/ibex/frontend/ast.rbs +33 -7
- data/sig/ibex/frontend/bootstrap_parser.rbs +2 -0
- data/sig/ibex/frontend/diagnostic.rbs +2 -2
- data/sig/ibex/frontend/formatter.rbs +38 -30
- data/sig/ibex/frontend/generated_parser.rbs +87 -77
- data/sig/ibex/frontend/generated_parser_base.rbs +4 -2
- data/sig/ibex/frontend/parser/declarations.rbs +3 -0
- data/sig/ibex/frontend/parser_configuration_support.rbs +27 -0
- data/sig/ibex/frontend/resolution.rbs +3 -2
- data/sig/ibex/frontend/source_cursor.rbs +2 -2
- data/sig/ibex/frontend/source_span.rbs +5 -2
- data/sig/ibex/frontend/token_adapter/declaration_state.rbs +13 -1
- data/sig/ibex/frontend/token_adapter.rbs +6 -0
- data/sig/ibex/fuzz.rbs +71 -0
- data/sig/ibex/generation_input.rbs +2 -2
- data/sig/ibex/generation_manifest.rbs +35 -32
- data/sig/ibex/generation_transaction_recovery.rbs +2 -2
- data/sig/ibex/generation_transaction_validation.rbs +2 -2
- data/sig/ibex/grammar_tests.rbs +2 -2
- data/sig/ibex/ir/automaton_ir.rbs +30 -11
- data/sig/ibex/ir/grammar_ir.rbs +41 -27
- data/sig/ibex/ir/lexer_ir.rbs +8 -8
- data/sig/ibex/ir/parser_contract.rbs +69 -0
- data/sig/ibex/ir/serialize.rbs +63 -28
- data/sig/ibex/ir/validator/automaton.rbs +47 -44
- data/sig/ibex/ir/validator/base.rbs +35 -31
- data/sig/ibex/ir/validator/grammar.rbs +78 -67
- data/sig/ibex/ir/validator/lexer.rbs +4 -4
- data/sig/ibex/ir.rbs +9 -3
- data/sig/ibex/lalr/build_metrics.rbs +42 -2
- data/sig/ibex/lalr/builder.rbs +75 -24
- data/sig/ibex/lalr/conflict_search.rbs +5 -2
- data/sig/ibex/lalr/counterexample.rbs +17 -14
- data/sig/ibex/lalr/direct_lookaheads.rbs +35 -28
- data/sig/ibex/lalr/goto_follows.rbs +89 -0
- data/sig/ibex/lalr/ielr/annotator.rbs +67 -0
- data/sig/ibex/lalr/ielr/bits.rbs +14 -0
- data/sig/ibex/lalr/ielr/inadequacy.rbs +24 -0
- data/sig/ibex/lalr/ielr/item_lookaheads.rbs +35 -0
- data/sig/ibex/lalr/ielr/pipeline.rbs +17 -0
- data/sig/ibex/lalr/ielr/split_stability.rbs +27 -0
- data/sig/ibex/lalr/ielr/split_state.rbs +14 -0
- data/sig/ibex/lalr/ielr/state_splitter.rbs +76 -0
- data/sig/ibex/lalr/ielr_partition.rbs +17 -5
- data/sig/ibex/lalr/inadequacy_report.rbs +21 -0
- data/sig/ibex/lalr/lookahead_propagation.rbs +38 -0
- data/sig/ibex/lalr/lr0_collection.rbs +50 -0
- data/sig/ibex/lalr/unreachable_states.rbs +25 -0
- data/sig/ibex/lalr.rbs +11 -1
- data/sig/ibex/location.rbs +6 -6
- data/sig/ibex/lsp/document_handlers.rbs +8 -8
- data/sig/ibex/lsp/initialization_handlers.rbs +12 -12
- data/sig/ibex/lsp/navigation_handlers.rbs +15 -12
- data/sig/ibex/lsp/parser_configuration_assistance.rbs +49 -0
- data/sig/ibex/lsp/position_codec.rbs +8 -4
- data/sig/ibex/lsp/request_handlers.rbs +4 -4
- data/sig/ibex/lsp/request_support.rbs +8 -8
- data/sig/ibex/lsp/server.rbs +16 -16
- data/sig/ibex/lsp/symbol_index.rbs +20 -21
- data/sig/ibex/lsp/symbol_index_builder.rbs +9 -8
- data/sig/ibex/lsp/symbol_occurrence.rbs +11 -5
- data/sig/ibex/lsp/transport.rbs +18 -6
- data/sig/ibex/lsp/workspace.rbs +3 -2
- data/sig/ibex/lsp/workspace_analyzer.rbs +1 -1
- data/sig/ibex/messages.rbs +26 -0
- data/sig/ibex/metrics.rbs +50 -0
- data/sig/ibex/normalize/diagnostics.rbs +4 -4
- data/sig/ibex/normalize/expander.rbs +2 -2
- data/sig/ibex/normalize/expression.rbs +10 -8
- data/sig/ibex/normalize/grammar_builder.rbs +11 -0
- data/sig/ibex/normalize/inline_expansion.rbs +59 -50
- data/sig/ibex/normalize/lexer.rbs +4 -4
- data/sig/ibex/normalize/parameter_ebnf_lowering.rbs +15 -14
- data/sig/ibex/normalize/parameter_lowering.rbs +18 -18
- data/sig/ibex/normalize/parameters.rbs +13 -8
- data/sig/ibex/normalize/parser_configuration.rbs +23 -0
- data/sig/ibex/normalize.rbs +11 -5
- data/sig/ibex/racc_migration/report.rbs +8 -6
- data/sig/ibex/rake_task.rbs +1 -1
- data/sig/ibex/samples.rbs +13 -4
- data/sig/ibex/table_artifact/builder.rbs +93 -0
- data/sig/ibex/table_artifact/cst_projection.rbs +20 -0
- data/sig/ibex/table_artifact/document.rbs +27 -0
- data/sig/ibex/table_artifact/executor.rbs +66 -0
- data/sig/ibex/table_artifact/serializer.rbs +25 -0
- data/sig/ibex/table_artifact/validator/metadata.rbs +52 -0
- data/sig/ibex/table_artifact/validator/support.rbs +46 -0
- data/sig/ibex/table_artifact/validator/tables.rbs +63 -0
- data/sig/ibex/table_artifact/validator.rbs +66 -0
- data/sig/ibex/table_artifact.rbs +32 -0
- data/sig/ibex/table_simulation/result.rbs +8 -4
- data/sig/ibex/table_simulation/step.rbs +4 -2
- data/sig/ibex/tables.rbs +10 -9
- data/sig/ibex/verifiable_generation_bundle.rbs +24 -0
- data/sig/ibex/verification_report/builder.rbs +53 -0
- data/sig/ibex/verification_report/canonical_ir.rbs +41 -0
- data/sig/ibex/verification_report/logical_path.rbs +34 -0
- data/sig/ibex/verification_report/validator.rbs +114 -0
- data/sig/ibex/verification_report.rbs +44 -0
- data/sig/ibex/verify/action_correspondence.rbs +50 -0
- data/sig/ibex/verify/language_witness.rbs +112 -0
- data/sig/ibex/verify/reference_collection.rbs +63 -0
- data/sig/ibex/verify/result.rbs +52 -0
- data/sig/ibex/verify/verifier.rbs +170 -0
- data/sig/ibex/verify.rbs +6 -0
- data/sig/ibex/watch/runner.rbs +12 -2
- data/sig/ibex/watch/source_snapshot.rbs +13 -9
- metadata +232 -12
- data/lib/ibex/ir/migration.rb +0 -120
- data/sig/ibex/ir/migration.rbs +0 -34
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration model
|
|
3
|
+
description: Decide which parser settings belong to grammar source and which belong to an invocation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Configuration model
|
|
7
|
+
|
|
8
|
+
Ibex keeps reproducible grammar intent in the grammar and keeps environment or
|
|
9
|
+
review choices at the invocation boundary. This separation prevents a build
|
|
10
|
+
flag from silently changing a source-owned parser contract.
|
|
11
|
+
|
|
12
|
+
## Grammar-owned settings
|
|
13
|
+
|
|
14
|
+
Declare settings in an extended grammar when every consumer should observe the
|
|
15
|
+
same choice:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
class ExampleParser
|
|
19
|
+
pragma extended
|
|
20
|
+
parser
|
|
21
|
+
algorithm ielr
|
|
22
|
+
entries isolated
|
|
23
|
+
end
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The current grammar-owned parser block supports `slr`, `lalr`, `ielr`, or
|
|
27
|
+
`lr1` construction and `shared` or `isolated` entry handling. The declaration
|
|
28
|
+
is part of normalized Grammar IR and is visible in generated reports.
|
|
29
|
+
|
|
30
|
+
## Invocation-owned settings
|
|
31
|
+
|
|
32
|
+
Keep these choices at the CLI or API call site because they describe a local
|
|
33
|
+
operation rather than the grammar's meaning:
|
|
34
|
+
|
|
35
|
+
- output path and embedded-runtime selection (`-o`, `-E`);
|
|
36
|
+
- table representation and diagnostic format;
|
|
37
|
+
- warnings, verification strictness, resource budgets, and report output;
|
|
38
|
+
- a temporary analysis algorithm used for comparison or investigation; and
|
|
39
|
+
- external command execution for explicitly unsafe fuzz or reduction workflows.
|
|
40
|
+
|
|
41
|
+
An invocation may select an analysis algorithm, but it must report that the
|
|
42
|
+
selection is noncanonical when it differs from the grammar declaration. A
|
|
43
|
+
conflicting canonical selection is rejected at the declaration location.
|
|
44
|
+
|
|
45
|
+
## Review checklist
|
|
46
|
+
|
|
47
|
+
When adding a setting, ask:
|
|
48
|
+
|
|
49
|
+
1. Would two independent users of the same grammar need the same value? If so,
|
|
50
|
+
it is grammar-owned.
|
|
51
|
+
2. Is the value about this run, host, output, or evidence capture? If so, it is
|
|
52
|
+
invocation-owned.
|
|
53
|
+
3. Does changing it alter generated parser behavior, persisted IR, or runtime
|
|
54
|
+
ABI? Update the relevant schema, fixture, maturity entry, and migration note.
|
|
55
|
+
4. Is the setting opt-in? Keep the compatible default unchanged and document
|
|
56
|
+
the activation boundary next to the option.
|
|
57
|
+
|
|
58
|
+
See the [stability policy](stability.md), [grammar reference](grammar-reference.md),
|
|
59
|
+
and [development guide](development.md) for contract and verification rules.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Effective configuration reports
|
|
2
|
+
|
|
3
|
+
`ibex config` explains every key in `Ibex::Configuration::Registry` without generating or loading a parser:
|
|
4
|
+
|
|
5
|
+
```console
|
|
6
|
+
ibex config grammar.y
|
|
7
|
+
ibex config --format=json grammar.y
|
|
8
|
+
ibex config --from=grammar-ir --format=json grammar.json
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The command has a `static-no-user-code` trust boundary. For grammar source it uses the contained source resolver, so
|
|
12
|
+
the root grammar and its import closure are parsed as data while parent traversal, absolute imports, glob imports,
|
|
13
|
+
and symlink escapes are rejected. Parser actions, lexer actions, user-code sections, and generated parser classes are
|
|
14
|
+
never executed or required. Grammar IR input is accepted only through the normal current-format validator.
|
|
15
|
+
|
|
16
|
+
Each setting reports its effective value, owner, override policy, origin and source location when recorded,
|
|
17
|
+
explicit or implicit selection, canonical or noncanonical conformance, recording status, and source evidence.
|
|
18
|
+
Evidence is classified as `accepted`, `ignored`, `duplicate`, or `conflicting`. The JSON projection is deterministic,
|
|
19
|
+
uses schema version 1, and always lists canonical keys in lexical order.
|
|
20
|
+
|
|
21
|
+
The current Grammar IR `parser_contract` entries are authoritative for `parser.algorithm`, `parser.entries`, and `cst.trivia`.
|
|
22
|
+
A matching command-line request is retained as accepted evidence. A contradictory request produces a positioned,
|
|
23
|
+
structured conflict report and exits nonzero. An unspecified entry remains explicitly `unspecified`; a document without
|
|
24
|
+
the current contract is rejected. A current builtin or CLI value is never presented as a historical fact.
|
|
25
|
+
|
|
26
|
+
The source grammar syntax supports the root-only declarative parser block in extended mode. CST ownership is
|
|
27
|
+
declared as `cst_trivia leading|balanced|drop` and requires `pragma cst`; `ibex config` reports the resulting
|
|
28
|
+
value and source location without executing user code. It does not recognize generic or unknown settings.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# H004 independent review records
|
|
2
|
+
|
|
3
|
+
During blind collection, review only
|
|
4
|
+
`docs/conflict-explanation-reviews/v1/blind-study-v1.json`. Do not inspect the
|
|
5
|
+
source study, review registry, implementation, or repository history until the
|
|
6
|
+
submission has been sealed. The blind artifact uses neutral IDs and excludes
|
|
7
|
+
the source case ID, shape, grammar path, and maintainer hypothesis. For every
|
|
8
|
+
case, use its state items, competing actions, bounded witness, and repair
|
|
9
|
+
section to identify the cause and choose an edit without executing grammar
|
|
10
|
+
actions.
|
|
11
|
+
|
|
12
|
+
A record must match `schema/conflict-explanation-review-v1.schema.json`'s
|
|
13
|
+
`review_record` definition and contain exactly one review for each of
|
|
14
|
+
`H004-BLIND-01` through `H004-BLIND-04`. Copy the blind artifact SHA-256 into
|
|
15
|
+
the record, set `submitted_before_reveal` to true only when accurate, record
|
|
16
|
+
your own cause and edit text, and leave `reveal_comparison.status` as `pending`.
|
|
17
|
+
If the machine artifact offers no verified repair, `chosen_edit` may describe a
|
|
18
|
+
manual edit and `repair_usefulness` should remain `no_verified_repair` unless
|
|
19
|
+
there is an actual proposal to assess.
|
|
20
|
+
|
|
21
|
+
The registry remains in `blind_collection` and `HOLD` until it has at least two
|
|
22
|
+
records from distinct reviewers. Only then may the source study be revealed.
|
|
23
|
+
During `reveal_comparison`, map every neutral ID to its source case, bind the
|
|
24
|
+
source study digest, and record cause/edit alignment plus notes without
|
|
25
|
+
rewriting the original blind answers. The registry reaches `review_complete`
|
|
26
|
+
and `PASS` only when every record has a completed reveal comparison. Do not
|
|
27
|
+
collapse disagreements into a majority label; preserve them in each record and
|
|
28
|
+
in the registry summary.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Conflict-explanation usefulness study
|
|
2
|
+
|
|
3
|
+
H004 separates reproducible machine evidence from subjective usefulness
|
|
4
|
+
review. The committed version-1 corpus contains four grammar shapes and five
|
|
5
|
+
conflicts:
|
|
6
|
+
|
|
7
|
+
- an ambiguous expression and dangling `else` shift/reduce conflict;
|
|
8
|
+
- an ambiguous reduce/reduce choice;
|
|
9
|
+
- two nonunifying reduce/reduce conflicts introduced by LALR context merging.
|
|
10
|
+
|
|
11
|
+
Each case binds its grammar bytes, Automaton IR digest, conflicting state items,
|
|
12
|
+
competing actions, resolution, and bounded witness. It also runs the existing
|
|
13
|
+
`fix` candidate search with fixed limits. Only the expression case currently
|
|
14
|
+
has a machine-verified proposal: declaring right associativity for `PLUS`
|
|
15
|
+
removes the conflict and finds no language or mapped-tree difference within the
|
|
16
|
+
recorded bounds. The other cases truthfully record `no_safe_proposal`; advice
|
|
17
|
+
that merely acknowledges a conflict or changes recovery is labeled as not a
|
|
18
|
+
verified repair.
|
|
19
|
+
|
|
20
|
+
Every witness records its typed search outcome, explored configuration count,
|
|
21
|
+
exhaustion flag, and token/configuration bounds. A configuration-budget
|
|
22
|
+
exhaustion is `inconclusive`; it is never relabeled as a nonunifying witness or
|
|
23
|
+
accepted into the fixed study capture.
|
|
24
|
+
|
|
25
|
+
Regenerate or verify the machine capture with:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
bundle exec ruby tool/conflict_explanation_study.rb --write
|
|
29
|
+
bundle exec rake quality:conflict_explanations
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The normative machine artifact is
|
|
33
|
+
[`study-v1.json`](../test/fixtures/conflict_explanations/study-v1.json),
|
|
34
|
+
validated by the closed
|
|
35
|
+
[`schema`](../schema/conflict-explanation-study-v1.schema.json). The capture
|
|
36
|
+
uses repository-owned grammars and never executes grammar actions. Search,
|
|
37
|
+
candidate, build, equivalence, and verifier limits are explicit; exhaustion is
|
|
38
|
+
not success. The detailed pre-implementation contract and kill conditions are
|
|
39
|
+
recorded in the [investigation](investigations/H004-conflict-explanation-study.md).
|
|
40
|
+
|
|
41
|
+
## Independent human gate
|
|
42
|
+
|
|
43
|
+
The machine capture proves reproducibility, not usefulness. Independent
|
|
44
|
+
reviewers receive only the deterministic
|
|
45
|
+
[`blind-study-v1.json`](conflict-explanation-reviews/v1/blind-study-v1.json)
|
|
46
|
+
view. It uses neutral case IDs and omits the repository case ID, shape, grammar
|
|
47
|
+
path, and `maintainer_hypothesis`. Reviewers use its state/items and witness to
|
|
48
|
+
identify the cause, then choose an edit and explain whether the explanation and
|
|
49
|
+
proposed repair helped. Each submission binds the blind artifact digest and is
|
|
50
|
+
sealed before any expected answer is revealed.
|
|
51
|
+
The [record instructions](conflict-explanation-reviews/v1/records/README.md)
|
|
52
|
+
and [review schema](../schema/conflict-explanation-review-v1.schema.json)
|
|
53
|
+
preserve per-case rationales and reviewer disagreement.
|
|
54
|
+
|
|
55
|
+
The current subjective gate is **HOLD** with zero external records, as recorded
|
|
56
|
+
in the [status registry](conflict-explanation-review-status-v1.json). Once at
|
|
57
|
+
least two distinct blind submissions cover every neutral case, the repository
|
|
58
|
+
case mapping and maintainer hypotheses may be revealed. Each reviewer record
|
|
59
|
+
must then retain a per-case comparison against that revealed material. PASS is
|
|
60
|
+
possible only after every comparison is complete; disagreement cannot be
|
|
61
|
+
replaced with a majority percentage. Until then no usefulness rate,
|
|
62
|
+
comparative superiority, or general conflict-repair claim is publishable.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# IELR and multi-entry construction profiling
|
|
2
|
+
|
|
3
|
+
This document closes H005's profiling work without selecting or implementing a
|
|
4
|
+
new construction algorithm. The machine-readable authority is
|
|
5
|
+
[`construction-profile-v1.json`](../tool/profile/evidence/construction-profile-v1.json),
|
|
6
|
+
validated by
|
|
7
|
+
[`construction-profile-v1.schema.json`](../schema/construction-profile-v1.schema.json).
|
|
8
|
+
It is an `internal_local_observation`, not release or adoption evidence.
|
|
9
|
+
|
|
10
|
+
## Public profiler
|
|
11
|
+
|
|
12
|
+
Run the repository-owned and synthetic profiles with:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
bundle exec ruby tool/construction_profile.rb \
|
|
16
|
+
--wall-seconds=60 \
|
|
17
|
+
--output=tool/profile/evidence/construction-profile-v1.json
|
|
18
|
+
bundle exec rake quality:construction_profile
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Third-party observations require a full checkout that the existing public
|
|
22
|
+
workload manifest can verify. Each checkout must have the exact revision,
|
|
23
|
+
origin, clean status, grammar digest, and structural baseline:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
bundle exec ruby tool/construction_profile.rb \
|
|
27
|
+
--checkout=namae=/path/to/namae \
|
|
28
|
+
--checkout=bcdice_command=/path/to/BCDice \
|
|
29
|
+
--checkout=nokogiri_css=/path/to/nokogiri
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Omitting a checkout records its exact registry metadata as `not_run`; it does
|
|
33
|
+
not silently profile a cached file or substitute a synthetic grammar.
|
|
34
|
+
|
|
35
|
+
The artifact separates reconstructible source provenance from host-bound
|
|
36
|
+
observations. `provenance.base_revision` is only the Git base: when capture is
|
|
37
|
+
dirty, every H005 contract path records its observed digest, base-object
|
|
38
|
+
digest, and `base` / `modified` / `untracked` state. The clean flag is derived
|
|
39
|
+
from the exact porcelain status; the status, bound-path set, implementation
|
|
40
|
+
subset, host observation, and measurement policy each have an integrity
|
|
41
|
+
digest. The evidence file is excluded from the source and implementation
|
|
42
|
+
digests, so no digest refers to the bytes that contain itself.
|
|
43
|
+
|
|
44
|
+
The quality gate reconstructs the base objects, requires the base to be an
|
|
45
|
+
ancestor of the checked revision, verifies current contract bytes against the
|
|
46
|
+
bound paths, and checks all derived digests and workload/run entry identities.
|
|
47
|
+
Ruby version and options, kernel, CPU, and other host fields remain explicitly
|
|
48
|
+
host-bound rather than cross-platform goldens, but their recorded values are
|
|
49
|
+
validated against `environment_observation_sha256` before that observation is
|
|
50
|
+
excluded from the deterministic structural comparison.
|
|
51
|
+
|
|
52
|
+
Every construction has an explicit wall-time limit. Exceeding it records the
|
|
53
|
+
resource and limit. `NoMemoryError` and `SystemStackError` are recorded as
|
|
54
|
+
resource exhaustion. Those results establish only that a bound was observed;
|
|
55
|
+
they are not negative proofs about the language or algorithm.
|
|
56
|
+
|
|
57
|
+
## Counting contract
|
|
58
|
+
|
|
59
|
+
The profiler records these structural quantities from the construction that
|
|
60
|
+
already exists:
|
|
61
|
+
|
|
62
|
+
| Field | Meaning |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| `lr0_states` | Distinct LR(0) cores materialized directly or represented by the canonical collection. |
|
|
65
|
+
| `lr0_items` | Core-item occurrences across those distinct cores. |
|
|
66
|
+
| `canonical_states` / `canonical_items` | Canonical LR(1) states and item triples, only when that collection completes. |
|
|
67
|
+
| `final_states` / `final_items` | States and core-item occurrences after merge or IELR partitioning. |
|
|
68
|
+
| `final_lookahead_items` | Lookahead memberships across final core items. |
|
|
69
|
+
| `propagation_edges` | Deduplicated direct-LALR lookahead propagation edges; canonical paths report `not_applicable`. |
|
|
70
|
+
| `ielr_initial_partitions` / `ielr_final_partitions` | Compatible partitions before and after transition refinement. |
|
|
71
|
+
|
|
72
|
+
`not_applicable` is reserved for metrics that the selected construction path
|
|
73
|
+
does not perform, such as canonical-state counts in direct LALR. A metric that
|
|
74
|
+
would apply but could not be collected because construction timed out or
|
|
75
|
+
failed is `not_measured`; failure never masquerades as algorithmic absence.
|
|
76
|
+
|
|
77
|
+
Elapsed seconds are retained only as host-bound observations. The schema fixes
|
|
78
|
+
`release_gate` to `false`, and the quality gate deliberately removes elapsed
|
|
79
|
+
values before comparing evidence. Ruby's live-slot counters are neither a
|
|
80
|
+
peak measurement nor reproducible retained-object accounting, so peak retained
|
|
81
|
+
objects are truthfully `not_measured`. The current builders also expose no
|
|
82
|
+
state budget or portable per-build heap limit; both omissions are explicit in
|
|
83
|
+
the evidence.
|
|
84
|
+
|
|
85
|
+
Profiling is opt-in through `Builder(profile: true)`. Ordinary generation does
|
|
86
|
+
not calculate the additional item/core summaries. Parser tables, conflicts,
|
|
87
|
+
generated source, runtime ABI, Grammar IR, and Automaton IR are unchanged.
|
|
88
|
+
|
|
89
|
+
## Current observations
|
|
90
|
+
|
|
91
|
+
Synthetic and real workloads are separate cohorts. All repository grammar
|
|
92
|
+
revisions and SHA-256 digests come from the public workload registry. The
|
|
93
|
+
multi-entry diagnostic is the existing representative matrix grammar at the
|
|
94
|
+
recorded exact revision, not a new language fixture.
|
|
95
|
+
|
|
96
|
+
| Workload | Class | LR(0) states/items | Direct propagation edges | Canonical LR(1) states/items | IELR partitions initial/final | Final states |
|
|
97
|
+
| --- | --- | ---: | ---: | ---: | ---: | ---: |
|
|
98
|
+
| `gallery-calc` | repository synthetic | 15 / 76 | 99 | 27 / 674 | 15 / 15 | 15 |
|
|
99
|
+
| `gallery-json` | repository synthetic | 27 / 82 | 111 | 57 / 272 | 27 / 27 | 27 |
|
|
100
|
+
| `gallery-sql-lite` | repository synthetic | 26 / 53 | 55 | 26 / 115 | 26 / 26 | 26 |
|
|
101
|
+
| `matrix-multi-entry` | repository synthetic | 9 / 14 | n/a | 9 / 20 | 9 / 9 | 9 |
|
|
102
|
+
| `ibex-frontend` | repository real | 227 / 633 | 749 | 456 / 10,482 | 227 / 227 | 227 |
|
|
103
|
+
|
|
104
|
+
The table pairs direct-LALR edge counts with the canonical collection used by
|
|
105
|
+
current IELR. The multi-entry row reports the shared result; its committed run
|
|
106
|
+
records also contain isolated LALR and IELR. On this diagnostic all four
|
|
107
|
+
shared/isolated combinations retain 9 states, 14 final core items, and 20 final
|
|
108
|
+
lookahead memberships. That bounded synthetic equality is not evidence that a
|
|
109
|
+
direct multi-entry implementation lacks value on real grammars.
|
|
110
|
+
|
|
111
|
+
The three `public_real` identities—Namae, BCDice command, and Nokogiri CSS—are
|
|
112
|
+
recorded as `not_run` because no checkout satisfying the public manifest was
|
|
113
|
+
supplied for this evidence capture. They contribute no state, item, edge,
|
|
114
|
+
partition, failure, or timing observation. The only measured real workload is
|
|
115
|
+
the repository's production frontend; it has no unresolved conflict requiring
|
|
116
|
+
IELR, and current IELR partitions its 456 canonical states back to the same 227
|
|
117
|
+
final states as direct LALR.
|
|
118
|
+
|
|
119
|
+
## Decisions
|
|
120
|
+
|
|
121
|
+
Direct IELR is **NO-GO** under the current verifier and workload evidence.
|
|
122
|
+
Direct multi-entry is **MORE DATA**.
|
|
123
|
+
|
|
124
|
+
### Direct IELR — NO-GO
|
|
125
|
+
|
|
126
|
+
The threshold is at least two verified representative real grammars that both
|
|
127
|
+
show a practical canonical-collection cost and require IELR for semantically
|
|
128
|
+
meaningful conflicts. The current artifact has one measured real grammar, zero
|
|
129
|
+
real IELR-required conflict cases, and no verified public checkout.
|
|
130
|
+
|
|
131
|
+
[V001](verifier-trust-boundary.md) is complete, so the trust-boundary threshold
|
|
132
|
+
is satisfied. It also establishes a current NO-GO condition: default and
|
|
133
|
+
strict `ielr1` verification both enumerate the full canonical LR(1)
|
|
134
|
+
collection. A direct builder would therefore not remove canonical scale cost
|
|
135
|
+
from the current verified workflow, and the verifier does not establish IELR
|
|
136
|
+
adequacy or split witnesses. Together with no real IELR-required workload,
|
|
137
|
+
that makes direct IELR unjustified now rather than merely unmeasured.
|
|
138
|
+
|
|
139
|
+
Evidence that can change the decision must include verified real grammars,
|
|
140
|
+
material canonical state/item cost or observed exhaustion, meaningful
|
|
141
|
+
conflicts removed by IELR, a bounded verification plan that does not make full
|
|
142
|
+
canonical enumeration mandatory, and an owner accepting the specification and
|
|
143
|
+
maintenance budget. State-count vanity alone is insufficient.
|
|
144
|
+
|
|
145
|
+
### Direct multi-entry — MORE DATA
|
|
146
|
+
|
|
147
|
+
The threshold is at least two verified real multi-entry grammars plus either an
|
|
148
|
+
observed construction bound or at least twofold structural overhead in the
|
|
149
|
+
current shared path relative to an admitted direct plan. The registry contains
|
|
150
|
+
zero real multi-entry workloads. The existing synthetic matrix exercises both
|
|
151
|
+
shared and isolated modes, but neither its elapsed time nor its equal state
|
|
152
|
+
counts justify a production algorithm.
|
|
153
|
+
|
|
154
|
+
Evidence that can change the decision must add verified real multi-entry
|
|
155
|
+
grammars, preserve entry dispatch and shared conflict attribution, demonstrate
|
|
156
|
+
material structural cost, and identify an owner for the semantic and
|
|
157
|
+
maintenance plan.
|
data/docs/cst-migration.md
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# CST Red/Green migration
|
|
2
2
|
|
|
3
3
|
The runtime supports only the current format-v6 Red/Green representation for
|
|
4
|
-
`pragma cst`. CST parser tables from formats v1 through v5,
|
|
5
|
-
`cst: true` tables without structured metadata,
|
|
6
|
-
read and instruct the application to regenerate.
|
|
7
|
-
remain executable.
|
|
4
|
+
`pragma cst`. CST parser tables from formats v1 through v5, boolean
|
|
5
|
+
`cst: true` tables without structured metadata, and all v1-v5 non-CST tables
|
|
6
|
+
fail before the first token is read and instruct the application to regenerate.
|
|
8
7
|
|
|
9
8
|
Regenerate with the same command used for the grammar, for example:
|
|
10
9
|
|
data/docs/cst.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Concrete syntax trees
|
|
3
|
+
description: Lossless Red/Green CSTs, typed views, editing, and incremental session boundaries.
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# Red/Green concrete syntax trees
|
|
2
7
|
|
|
8
|
+
<!-- stable:batch-cst:v1 -->
|
|
9
|
+
|
|
3
10
|
`pragma cst` generates a lossless, error-tolerant syntax tree alongside the
|
|
4
11
|
ordinary semantic result. Regenerate the parser with the current generator to
|
|
5
12
|
receive parser-table format v6 and this API. Batch parsing, typed views,
|
|
@@ -32,6 +39,10 @@ root = result.syntax_root
|
|
|
32
39
|
diagnostics = result.diagnostics
|
|
33
40
|
```
|
|
34
41
|
|
|
42
|
+
This is a trusted application runtime path. Parser production actions and
|
|
43
|
+
generated lexer actions execute, and loading the generated Ruby file may run
|
|
44
|
+
`header`, `inner`, or `footer` code. `parse_with_syntax` is not a sandbox.
|
|
45
|
+
|
|
35
46
|
`parse`, `do_parse`, and `yyparse` keep their semantic return values.
|
|
36
47
|
`parser.syntax_root` exposes the most recent syntax root. Every successful root
|
|
37
48
|
has this physical shape:
|
|
@@ -144,6 +155,13 @@ but no semantic value. Generated lexer actions still run because they define
|
|
|
144
155
|
token emission and lexer-state changes. Run a normal parse separately when a
|
|
145
156
|
semantic value or side effect is required.
|
|
146
157
|
|
|
158
|
+
Consequently, `parse_syntax` and `incremental_session` are syntax-only but not
|
|
159
|
+
"no user code" APIs. Loading the generated class may execute user sections,
|
|
160
|
+
and lexer actions may perform arbitrary Ruby side effects. Treat the generated
|
|
161
|
+
class as trusted application code. A future nonexecuting syntax profile would
|
|
162
|
+
require a declarative built-in-only lexer and no `header`, `inner`, or `footer`
|
|
163
|
+
sections; the current API does not provide that profile.
|
|
164
|
+
|
|
147
165
|
Sessions require `SourceText`, a generated lexer, format-v6 CST metadata, and
|
|
148
166
|
non-`drop` trivia. Handwritten token sources and push input are unsupported.
|
|
149
167
|
Parser actions that alone switch lexer state are also unavailable because the
|
|
@@ -157,6 +175,12 @@ memo bytes; a bound failure deterministically falls back to the fresh token
|
|
|
157
175
|
stream. Observe `cst_built`, `cst_reuse`, and `cst_fallback` runtime events for
|
|
158
176
|
metrics.
|
|
159
177
|
|
|
178
|
+
Applications that need an explicit generated-language service boundary can use
|
|
179
|
+
the Experimental [`syntax_session` façade](syntax-sessions.md). It adds
|
|
180
|
+
trust-profile acknowledgement, immutable operation snapshots, expected tokens,
|
|
181
|
+
reuse/fallback metrics, cancellation, and service resource bounds while using
|
|
182
|
+
this same incremental engine. It does not add LSP or workspace semantics.
|
|
183
|
+
|
|
160
184
|
## Serialization
|
|
161
185
|
|
|
162
186
|
`ibex_cst` schema v1 is independent from Grammar IR:
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# ADR NNNN: Implementation decision title
|
|
2
|
+
|
|
3
|
+
- Status: Proposed
|
|
4
|
+
- Date: YYYY-MM-DD
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
Describe the concrete implementation question and its compatibility, data,
|
|
9
|
+
runtime, or component constraints. Operational workflow and release policy do
|
|
10
|
+
not belong in this directory; see [the scope](README.md).
|
|
11
|
+
|
|
12
|
+
Name the credible alternatives. If there was no meaningful alternative, record
|
|
13
|
+
the behavior in reference documentation instead of creating an ADR.
|
|
14
|
+
|
|
15
|
+
## Decision
|
|
16
|
+
|
|
17
|
+
Describe the durable boundary or architecture choice. Leave command syntax,
|
|
18
|
+
field-by-field formats, test evidence, benchmark results, and migration steps
|
|
19
|
+
in their authoritative documents.
|
|
20
|
+
|
|
21
|
+
## Consequences
|
|
22
|
+
|
|
23
|
+
Describe the important positive and negative trade-offs, including what would
|
|
24
|
+
make this decision worth revisiting.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ADR 0001: Separate pipeline stages with current IR
|
|
2
|
+
|
|
3
|
+
- Status: Accepted
|
|
4
|
+
- Date: 2026-07-28
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
Frontend parsing, normalization, automaton construction, and code generation
|
|
9
|
+
must be independently testable and resumable. Passing frontend objects between
|
|
10
|
+
all stages would couple later stages to source syntax and make serialized
|
|
11
|
+
artifacts ambiguous.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
Normalization produces immutable Grammar IR. Parser construction consumes
|
|
16
|
+
Grammar IR and produces immutable Automaton IR. Automaton IR embeds the Grammar
|
|
17
|
+
IR required to resume code generation; later stages do not reach back into
|
|
18
|
+
frontend AST objects.
|
|
19
|
+
|
|
20
|
+
Both IRs have deterministic JSON encodings and shipped closed schemas. Their
|
|
21
|
+
current schema contract is explicit and validated. Untrusted JSON crosses a
|
|
22
|
+
validator that checks both shape and cross-record references before constructing
|
|
23
|
+
Ruby objects. A pre-v1 change that alters the meaning or required shape is
|
|
24
|
+
coordinated across writers, readers, schemas, fixtures, and downstream
|
|
25
|
+
consumers; no legacy reader is retained solely to preserve an obsolete format.
|
|
26
|
+
|
|
27
|
+
## Consequences
|
|
28
|
+
|
|
29
|
+
- Source, resumed Grammar IR, and resumed Automaton IR use the same downstream
|
|
30
|
+
implementations.
|
|
31
|
+
- Incompatibility is detected at the document boundary rather than deep in
|
|
32
|
+
generation.
|
|
33
|
+
- Presentation views and operational reports are not additional IRs unless
|
|
34
|
+
another tool must consume them as durable data.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ADR 0002: Keep grammar-embedded Ruby opaque until code generation
|
|
2
|
+
|
|
3
|
+
- Status: Accepted
|
|
4
|
+
- Date: 2026-07-28
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
Semantic actions and user-code sections contain Ruby constructs whose braces,
|
|
9
|
+
quotes, regular expressions, interpolation, and heredocs overlap grammar
|
|
10
|
+
delimiters. Parsing Ruby in the grammar frontend would add a second language
|
|
11
|
+
implementation and would still not validate parser-local bindings correctly.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
The grammar lexer delegates action bodies to a balanced source scanner. That
|
|
16
|
+
scanner recognizes only the Ruby lexical structure needed to find the matching
|
|
17
|
+
grammar boundary and preserves the original bytes and source location.
|
|
18
|
+
User-code sections are likewise retained as ordered opaque chunks.
|
|
19
|
+
|
|
20
|
+
The frontend, normalizer, IR tools, reports, and static analysis never evaluate
|
|
21
|
+
or rewrite the opaque body. Ruby compilation occurs only when generated parser
|
|
22
|
+
methods are loaded. Tools that promise not to execute application code must
|
|
23
|
+
operate entirely before that boundary.
|
|
24
|
+
|
|
25
|
+
## Consequences
|
|
26
|
+
|
|
27
|
+
- Grammar parsing is independent of a Ruby parser and preserves exact user
|
|
28
|
+
source for mapping and generation.
|
|
29
|
+
- The balanced scanner has an explicit lexical coverage obligation; unsupported
|
|
30
|
+
Ruby syntax must fail instead of being silently truncated.
|
|
31
|
+
- Features that need meaning from an action must use conservative lexical
|
|
32
|
+
evidence or decline the optimization.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ADR 0003: Self-host the grammar parser behind an explicit bootstrap
|
|
2
|
+
|
|
3
|
+
- Status: Accepted
|
|
4
|
+
- Date: 2026-07-28
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
Keeping grammar syntax in a handwritten parser makes the generator unable to
|
|
9
|
+
exercise its own parser pipeline. Direct self-hosting creates a cycle because
|
|
10
|
+
the generated grammar parser is needed to regenerate itself.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
`lib/ibex/frontend/grammar.y` is the canonical grammar syntax. Its generated
|
|
15
|
+
parser is committed and is the normal frontend implementation. A specialized
|
|
16
|
+
lexer remains outside that grammar because opaque Ruby scanning and source
|
|
17
|
+
locations are lexical responsibilities.
|
|
18
|
+
|
|
19
|
+
An explicitly named bootstrap parser exists only to regenerate the committed
|
|
20
|
+
parser when that parser is absent. The regeneration path loads the minimum
|
|
21
|
+
frontend and generation components directly and does not load the normal
|
|
22
|
+
generated frontend. Normal library loading does not use the bootstrap.
|
|
23
|
+
|
|
24
|
+
No racc implementation or racc-generated source participates in bootstrap or
|
|
25
|
+
normal execution.
|
|
26
|
+
|
|
27
|
+
## Consequences
|
|
28
|
+
|
|
29
|
+
- Ordinary grammar parsing continuously exercises Ibex-generated code.
|
|
30
|
+
- Grammar syntax changes must keep the canonical grammar, bootstrap capability,
|
|
31
|
+
and generated parser deterministic and mutually consistent.
|
|
32
|
+
- The bootstrap is recovery infrastructure, not a second supported frontend.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# ADR 0004: Derive semantic and lossless source views from one lexing pass
|
|
2
|
+
|
|
3
|
+
- Status: Accepted
|
|
4
|
+
- Date: 2026-07-28
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
Generation needs a semantic AST, while formatting, diagnostics, documentation,
|
|
9
|
+
and editor features need comments, trivia, opaque bodies, and exact byte
|
|
10
|
+
ranges. Re-lexing independently for each tool can disagree with the token
|
|
11
|
+
stream that defined grammar meaning.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
One frontend lexing pass produces semantic tokens and immutable lossless
|
|
16
|
+
segments over the same UTF-8 source. A source document correlates those views
|
|
17
|
+
with half-open byte spans and reproduces the accepted input exactly. The
|
|
18
|
+
self-hosted parser remains the authority for the semantic AST.
|
|
19
|
+
|
|
20
|
+
Recovering diagnostics are bounded and may expose a clearly marked partial AST,
|
|
21
|
+
but never attach that projection to the unchanged source as if it were a
|
|
22
|
+
complete parse. Formatting changes trivia only, then reparses and rejects any
|
|
23
|
+
semantic difference. Filesystem and unsaved-buffer access are supplied through
|
|
24
|
+
an injected source loader; the parser itself performs no I/O.
|
|
25
|
+
|
|
26
|
+
## Consequences
|
|
27
|
+
|
|
28
|
+
- Formatter, documentation, resolver, and LSP features share one interpretation
|
|
29
|
+
of tokens, opaque Ruby, locations, and source bytes.
|
|
30
|
+
- Exact byte coordinates remain distinct from editor-specific coordinate
|
|
31
|
+
encodings such as UTF-16.
|
|
32
|
+
- Error recovery and overlays are tool boundaries around the strict parser,
|
|
33
|
+
not alternative grammar semantics.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ADR 0005: Resolve grammar composition in a contained filesystem boundary
|
|
2
|
+
|
|
3
|
+
- Status: Accepted
|
|
4
|
+
- Date: 2026-07-28
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
Composing grammar fragments introduces file identity, traversal order, cycles,
|
|
9
|
+
diamonds, source provenance, and symlink escape. Textual concatenation loses
|
|
10
|
+
those properties and makes programmatic source parsing perform implicit I/O.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
Root and fragment files have distinct syntax and ownership. Parsing records
|
|
15
|
+
`import` nodes without reading their targets. A resolver is the sole filesystem
|
|
16
|
+
boundary and returns one immutable resolution containing the merged AST,
|
|
17
|
+
canonical dependency closure, and include provenance.
|
|
18
|
+
|
|
19
|
+
Canonical real paths define identity. Imports are resolved in deterministic
|
|
20
|
+
depth-first order, a completed canonical file is merged once, and cycles are
|
|
21
|
+
reported by canonical path. Targets must remain below the canonical root
|
|
22
|
+
directory after symlink resolution; absolute paths, parent traversal, and
|
|
23
|
+
ambiguous path forms are rejected.
|
|
24
|
+
|
|
25
|
+
Every CLI and build integration that accepts a grammar path uses this resolver.
|
|
26
|
+
Programmatic source-string parsing must opt into it explicitly.
|
|
27
|
+
|
|
28
|
+
## Consequences
|
|
29
|
+
|
|
30
|
+
- All consumers observe the same merge order and dependency closure.
|
|
31
|
+
- Diamonds are deterministic and symlink aliases cannot hide a cycle or escape
|
|
32
|
+
the root.
|
|
33
|
+
- Composition is intentionally a flat merge; namespaces and re-export policy
|
|
34
|
+
require a separate design.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ADR 0006: Lower grammar extensions structurally and under explicit bounds
|
|
2
|
+
|
|
3
|
+
- Status: Accepted
|
|
4
|
+
- Date: 2026-07-28
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
EBNF, parameterized rules, and inline rules can be represented as textual
|
|
9
|
+
macros, frontend-only closures, or structural transformations. Textual
|
|
10
|
+
expansion loses locations and can capture names; unbounded recursive expansion
|
|
11
|
+
can exhaust the Ruby stack or memory.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
The frontend represents extensions as AST structure. Normalization lowers them
|
|
16
|
+
into ordinary symbols, productions, and serializable action-composition plans
|
|
17
|
+
before automaton construction. Synthetic names cannot collide with source
|
|
18
|
+
identifiers, and generated productions retain source and expansion provenance.
|
|
19
|
+
|
|
20
|
+
Parameterized specializations are memoized by structural arguments. Recursive
|
|
21
|
+
work uses explicit worklists, rejects structurally growing cycles, and has a
|
|
22
|
+
total specialization bound. Inline substitution rejects recursive dependency
|
|
23
|
+
cycles and has a separate materialization bound for alternative products.
|
|
24
|
+
Opaque action fragments remain ordered data in Grammar IR rather than
|
|
25
|
+
generator-only closures.
|
|
26
|
+
|
|
27
|
+
## Consequences
|
|
28
|
+
|
|
29
|
+
- Every parser-construction algorithm consumes the same lowered Grammar IR.
|
|
30
|
+
- Resumed IR preserves extension semantics and source mapping.
|
|
31
|
+
- Some theoretically finite expansions may be rejected by conservative cycle
|
|
32
|
+
or resource bounds; callers can raise size bounds deliberately.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# ADR 0007: Share one downstream pipeline across parser algorithms
|
|
2
|
+
|
|
3
|
+
- Status: Accepted
|
|
4
|
+
- Date: 2026-07-28
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
SLR, LALR, IELR, and canonical LR(1) differ in state construction and
|
|
9
|
+
lookahead precision. Separate conflict resolution, table generation, or code
|
|
10
|
+
generation paths would make algorithm selection change more than the automaton.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
All algorithms consume Grammar IR and produce the same Automaton IR contract.
|
|
15
|
+
They share action candidate construction, conflict resolution, default-action
|
|
16
|
+
selection, reporting, table generation, and code generation.
|
|
17
|
+
|
|
18
|
+
LALR is the default and computes lookaheads directly over deterministic LR(0)
|
|
19
|
+
item occurrences. SLR uses the same LR(0) collection with FOLLOW sets.
|
|
20
|
+
Canonical LR(1) retains distinct contexts. IELR conservatively merges
|
|
21
|
+
compatible canonical states and prefers extra states whenever equivalence is
|
|
22
|
+
uncertain; it does not claim a minimum state count.
|
|
23
|
+
|
|
24
|
+
Reference strategies may remain for equivalence testing, but they are not
|
|
25
|
+
additional public algorithm identities when their output contract is the same.
|
|
26
|
+
|
|
27
|
+
## Consequences
|
|
28
|
+
|
|
29
|
+
- Algorithm choice changes automaton precision without changing downstream
|
|
30
|
+
semantics or generated APIs.
|
|
31
|
+
- LALR avoids canonical state explosion in the default path.
|
|
32
|
+
- IELR can avoid LALR merge inadequacies but may pay canonical construction
|
|
33
|
+
cost and retain more states than a lane-tracing implementation.
|