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,41 @@
|
|
|
1
|
+
# Generated from lib/ibex/verification_report/canonical_ir.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module VerificationReport
|
|
5
|
+
# Rebuilds immutable IR with source locations expressed as report logical identities.
|
|
6
|
+
class CanonicalIR
|
|
7
|
+
type json_value = String | Integer | Float | bool | nil | Array[json_value] | Hash[json_value, json_value]
|
|
8
|
+
|
|
9
|
+
LOGICAL_ROOT: String
|
|
10
|
+
|
|
11
|
+
# @rbs (IR::Automaton automaton, source_records: Array[GenerationInput]) -> void
|
|
12
|
+
def initialize: (IR::Automaton automaton, source_records: Array[GenerationInput]) -> void
|
|
13
|
+
|
|
14
|
+
# @rbs () -> IR::Automaton
|
|
15
|
+
def build: () -> IR::Automaton
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
# @rbs (json_value value) -> json_value
|
|
20
|
+
def normalize_source_identity!: (json_value value) -> json_value
|
|
21
|
+
|
|
22
|
+
# @rbs (json_value value) -> String
|
|
23
|
+
def generate_json: (json_value value) -> String
|
|
24
|
+
|
|
25
|
+
# @rbs (json_value value) -> json_value
|
|
26
|
+
def normalize_for_json: (json_value value) -> json_value
|
|
27
|
+
|
|
28
|
+
# @rbs (String file) -> String
|
|
29
|
+
def logical_file: (String file) -> String
|
|
30
|
+
|
|
31
|
+
# @rbs (GenerationInput record, String file) -> bool
|
|
32
|
+
def record_matches?: (GenerationInput record, String file) -> bool
|
|
33
|
+
|
|
34
|
+
# @rbs (String file) -> bool
|
|
35
|
+
def absolute_file?: (String file) -> bool
|
|
36
|
+
|
|
37
|
+
# @rbs (IR::Grammar grammar) -> String
|
|
38
|
+
def digest: (IR::Grammar grammar) -> String
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Generated from lib/ibex/verification_report/logical_path.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module VerificationReport
|
|
5
|
+
# Closed logical identities used by version 1 verification reports.
|
|
6
|
+
module LogicalPath
|
|
7
|
+
MAX_INPUT_FILES: Integer
|
|
8
|
+
|
|
9
|
+
BASENAME: Regexp
|
|
10
|
+
|
|
11
|
+
INPUT: Regexp
|
|
12
|
+
|
|
13
|
+
TABLE: Regexp
|
|
14
|
+
|
|
15
|
+
# @rbs (String path, Integer index) -> String
|
|
16
|
+
def self?.input: (String path, Integer index) -> String
|
|
17
|
+
|
|
18
|
+
# @rbs (String path) -> String
|
|
19
|
+
def self?.table: (String path) -> String
|
|
20
|
+
|
|
21
|
+
# @rbs (Object? value, Integer index) -> bool
|
|
22
|
+
def self?.canonical_input?: (Object? value, Integer index) -> bool
|
|
23
|
+
|
|
24
|
+
# @rbs (Object? value) -> bool
|
|
25
|
+
def self?.canonical_table?: (Object? value) -> bool
|
|
26
|
+
|
|
27
|
+
# @rbs (String path) -> String
|
|
28
|
+
def self?.basename: (String path) -> String
|
|
29
|
+
|
|
30
|
+
# @rbs (String value) -> bool
|
|
31
|
+
def self?.usable_basename?: (String value) -> bool
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Generated from lib/ibex/verification_report/validator.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module VerificationReport
|
|
5
|
+
# Validates a report and its cross-artifact manifest/table bindings.
|
|
6
|
+
# rubocop:disable Metrics/ClassLength -- closed report and cross-artifact invariants form one validator contract.
|
|
7
|
+
class Validator
|
|
8
|
+
type json_value = String | Integer | Float | bool | nil | Array[json_value] | Hash[String, json_value]
|
|
9
|
+
|
|
10
|
+
ROOT_KEYS: Array[String]
|
|
11
|
+
|
|
12
|
+
CHECKER_KEYS: Array[String]
|
|
13
|
+
|
|
14
|
+
BOUNDS_KEYS: Array[String]
|
|
15
|
+
|
|
16
|
+
INPUT_KEYS: Array[String]
|
|
17
|
+
|
|
18
|
+
INPUT_FILE_KEYS: Array[String]
|
|
19
|
+
|
|
20
|
+
IR_KEYS: Array[String]
|
|
21
|
+
|
|
22
|
+
GRAMMAR_KEYS: Array[String]
|
|
23
|
+
|
|
24
|
+
AUTOMATON_KEYS: Array[String]
|
|
25
|
+
|
|
26
|
+
TABLE_KEYS: Array[String]
|
|
27
|
+
|
|
28
|
+
OUTCOME_KEYS: Array[String]
|
|
29
|
+
|
|
30
|
+
VIOLATION_KEYS: Array[String]
|
|
31
|
+
|
|
32
|
+
EXHAUSTION_KEYS: Array[String]
|
|
33
|
+
|
|
34
|
+
DIGEST: Regexp
|
|
35
|
+
|
|
36
|
+
ALGORITHMS: Array[String]
|
|
37
|
+
|
|
38
|
+
# @rbs (String source) -> Hash[String, json_value]
|
|
39
|
+
def validate: (String source) -> Hash[String, json_value]
|
|
40
|
+
|
|
41
|
+
# @rbs (manifest_source: String, report_source: String, table_source: String) -> Hash[String, json_value]
|
|
42
|
+
def validate_bundle: (manifest_source: String, report_source: String, table_source: String) -> Hash[String, json_value]
|
|
43
|
+
|
|
44
|
+
# @rbs (String manifest_path) -> Hash[String, json_value]
|
|
45
|
+
def validate_bundle_file: (String manifest_path) -> Hash[String, json_value]
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
# @rbs (json_value document) -> void
|
|
50
|
+
def validate_document: (json_value document) -> void
|
|
51
|
+
|
|
52
|
+
# @rbs (json_value value) -> void
|
|
53
|
+
def validate_checker: (json_value value) -> void
|
|
54
|
+
|
|
55
|
+
# @rbs (json_value value) -> void
|
|
56
|
+
def validate_bounds: (json_value value) -> void
|
|
57
|
+
|
|
58
|
+
# @rbs (json_value value) -> void
|
|
59
|
+
def validate_input: (json_value value) -> void
|
|
60
|
+
|
|
61
|
+
# @rbs (json_value value) -> void
|
|
62
|
+
def validate_ir: (json_value value) -> void
|
|
63
|
+
|
|
64
|
+
# @rbs (json_value value) -> void
|
|
65
|
+
def validate_table: (json_value value) -> void
|
|
66
|
+
|
|
67
|
+
# @rbs (json_value value, String profile) -> void
|
|
68
|
+
def validate_outcome: (json_value value, String profile) -> void
|
|
69
|
+
|
|
70
|
+
# @rbs (json_value value, Array[String] requested) -> Array[json_value]
|
|
71
|
+
def validate_violations: (json_value value, Array[String] requested) -> Array[json_value]
|
|
72
|
+
|
|
73
|
+
# @rbs (Hash[String, json_value] manifest, String kind) -> Hash[String, json_value]
|
|
74
|
+
def unique_artifact: (Hash[String, json_value] manifest, String kind) -> Hash[String, json_value]
|
|
75
|
+
|
|
76
|
+
# @rbs (Hash[String, json_value] entry, String source, String label) -> void
|
|
77
|
+
def validate_manifest_bytes!: (Hash[String, json_value] entry, String source, String label) -> void
|
|
78
|
+
|
|
79
|
+
# @rbs (Hash[String, json_value] manifest, Hash[String, json_value] report) -> void
|
|
80
|
+
def validate_inputs!: (Hash[String, json_value] manifest, Hash[String, json_value] report) -> void
|
|
81
|
+
|
|
82
|
+
# @rbs (Hash[String, json_value] report, TableArtifact::Document table,
|
|
83
|
+
# Hash[String, json_value] table_entry) -> void
|
|
84
|
+
def validate_table_binding!: (Hash[String, json_value] report, TableArtifact::Document table, Hash[String, json_value] table_entry) -> void
|
|
85
|
+
|
|
86
|
+
# @rbs (json_value value, String path) -> Array[String]
|
|
87
|
+
def checks: (json_value value, String path) -> Array[String]
|
|
88
|
+
|
|
89
|
+
# @rbs (json_value value, Array[String] keys, String path) -> Hash[String, json_value]
|
|
90
|
+
def object: (json_value value, Array[String] keys, String path) -> Hash[String, json_value]
|
|
91
|
+
|
|
92
|
+
# @rbs (json_value value, String path) -> Array[json_value]
|
|
93
|
+
def array: (json_value value, String path) -> Array[json_value]
|
|
94
|
+
|
|
95
|
+
# @rbs (json_value value, String path, ?allow_empty: bool) -> String
|
|
96
|
+
def string: (json_value value, String path, ?allow_empty: bool) -> String
|
|
97
|
+
|
|
98
|
+
# @rbs (json_value value, String path) -> String
|
|
99
|
+
def digest: (json_value value, String path) -> String
|
|
100
|
+
|
|
101
|
+
# @rbs (json_value value, String path) -> Integer
|
|
102
|
+
def positive_integer: (json_value value, String path) -> Integer
|
|
103
|
+
|
|
104
|
+
# @rbs (json_value value, String path) -> Integer
|
|
105
|
+
def nonnegative_integer: (json_value value, String path) -> Integer
|
|
106
|
+
|
|
107
|
+
# @rbs [T] (T value, Array[T] values, String path) -> T
|
|
108
|
+
def enum: [T] (T value, Array[T] values, String path) -> T
|
|
109
|
+
|
|
110
|
+
# @rbs (json_value actual, json_value expected, String path) -> void
|
|
111
|
+
def equal: (json_value actual, json_value expected, String path) -> void
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Generated from lib/ibex/verification_report.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
# A versioned, scoped report that binds bounded verification to input and
|
|
5
|
+
# data-only parser table identities without claiming to verify opaque code.
|
|
6
|
+
module VerificationReport
|
|
7
|
+
IDENTIFIER: String
|
|
8
|
+
|
|
9
|
+
SCHEMA_VERSION: Integer
|
|
10
|
+
|
|
11
|
+
IR_IDENTITY_SCOPE: String
|
|
12
|
+
|
|
13
|
+
DEFAULT_MAX_STATES: Integer
|
|
14
|
+
|
|
15
|
+
DEFAULT_MAX_ITEMS: Integer
|
|
16
|
+
|
|
17
|
+
EXCLUDED_TRUST: Array[String]
|
|
18
|
+
|
|
19
|
+
class ValidationError < Ibex::Error
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Rebuild the supplied Automaton IR with path-neutral source locations for one bundle.
|
|
23
|
+
# @rbs (IR::Automaton automaton, source_records: Array[GenerationInput]) -> IR::Automaton
|
|
24
|
+
def self?.canonical_automaton: (IR::Automaton automaton, source_records: Array[GenerationInput]) -> IR::Automaton
|
|
25
|
+
|
|
26
|
+
# @rbs (IR::Automaton automaton, table: TableArtifact::Document,
|
|
27
|
+
# source_records: Array[GenerationInput], table_path: String, ?strict: bool,
|
|
28
|
+
# ?max_states: Integer, ?max_items: Integer) -> String
|
|
29
|
+
def self?.render: (IR::Automaton automaton, table: TableArtifact::Document, source_records: Array[GenerationInput], table_path: String, ?strict: bool, ?max_states: Integer, ?max_items: Integer) -> String
|
|
30
|
+
|
|
31
|
+
# Validate the closed report shape and its canonical evidence digest.
|
|
32
|
+
# @rbs (String source) -> Hash[String, VerificationReport::Validator::json_value]
|
|
33
|
+
def self?.validate: (String source) -> Hash[String, VerificationReport::Validator::json_value]
|
|
34
|
+
|
|
35
|
+
# Validate report, table, and manifest bytes as one non-cyclic bundle.
|
|
36
|
+
# @rbs (manifest_source: String, report_source: String, table_source: String) -> Hash[String, VerificationReport::Validator::json_value]
|
|
37
|
+
def self?.validate_bundle: (manifest_source: String, report_source: String, table_source: String) -> Hash[String, VerificationReport::Validator::json_value]
|
|
38
|
+
|
|
39
|
+
# Resolve the report and table through a manifest and validate every
|
|
40
|
+
# published artifact before checking the cross-artifact identities.
|
|
41
|
+
# @rbs (String manifest_path) -> Hash[String, VerificationReport::Validator::json_value]
|
|
42
|
+
def self?.validate_bundle_file: (String manifest_path) -> Hash[String, VerificationReport::Validator::json_value]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Generated from lib/ibex/verify/action_correspondence.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module Verify
|
|
5
|
+
type correspondence_action = IR::parser_action
|
|
6
|
+
|
|
7
|
+
# Compares resolved ACTION/GOTO behavior over all paired viable prefixes.
|
|
8
|
+
class ActionCorrespondence
|
|
9
|
+
class Difference < Struct[Symbol | Integer? | correspondence_action?]
|
|
10
|
+
attr_accessor kind: Symbol
|
|
11
|
+
attr_accessor canonical_state: Integer
|
|
12
|
+
attr_accessor target_state: Integer
|
|
13
|
+
attr_accessor symbol: Integer?
|
|
14
|
+
attr_accessor canonical: correspondence_action?
|
|
15
|
+
attr_accessor target: correspondence_action?
|
|
16
|
+
def self.new: (kind: Symbol, canonical_state: Integer, target_state: Integer, symbol: Integer?, canonical: correspondence_action?, target: correspondence_action?) -> instance
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Result < Struct[Array[Difference] | Integer | bool]
|
|
20
|
+
attr_accessor differences: Array[Difference]
|
|
21
|
+
attr_accessor explored: Integer
|
|
22
|
+
attr_accessor truncated: bool
|
|
23
|
+
def self.new: (differences: Array[Difference], explored: Integer, truncated: bool) -> instance
|
|
24
|
+
def ok?: () -> bool
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @rbs (IR::Automaton canonical, IR::Automaton target, ?max_pairs: Integer) -> void
|
|
28
|
+
def initialize: (IR::Automaton canonical, IR::Automaton target, ?max_pairs: Integer) -> void
|
|
29
|
+
|
|
30
|
+
# @rbs () -> Result
|
|
31
|
+
def verify: () -> Result
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
# @rbs (Integer, Integer, IR::AutomatonState, IR::AutomatonState,
|
|
36
|
+
# Array[Difference], Array[Array[Integer]]) -> void
|
|
37
|
+
def compare_terminals: (Integer, Integer, IR::AutomatonState, IR::AutomatonState, Array[Difference], Array[Array[Integer]]) -> void
|
|
38
|
+
|
|
39
|
+
# @rbs (Integer, Integer, IR::AutomatonState, IR::AutomatonState,
|
|
40
|
+
# Array[Difference], Array[Array[Integer]]) -> void
|
|
41
|
+
def compare_gotos: (Integer, Integer, IR::AutomatonState, IR::AutomatonState, Array[Difference], Array[Array[Integer]]) -> void
|
|
42
|
+
|
|
43
|
+
# @rbs (IR::AutomatonState, Integer) -> IR::parser_action
|
|
44
|
+
def effective_action: (IR::AutomatonState, Integer) -> IR::parser_action
|
|
45
|
+
|
|
46
|
+
# @rbs (IR::parser_action) -> Array[Object]
|
|
47
|
+
def action_signature: (IR::parser_action) -> Array[Object]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Generated from lib/ibex/verify/language_witness.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module Verify
|
|
5
|
+
type witness_status = :accepted | :error | :missing_entry | :shifted
|
|
6
|
+
|
|
7
|
+
# Compares canonical and submitted parser acceptance over a bounded set of
|
|
8
|
+
# terminal sequences. This is a semantic witness, not a proof of language
|
|
9
|
+
# equivalence: the reference collection is complete within its budgets and
|
|
10
|
+
# the token enumeration is deliberately finite.
|
|
11
|
+
class LanguageWitness
|
|
12
|
+
class Difference
|
|
13
|
+
attr_reader entry: String
|
|
14
|
+
|
|
15
|
+
attr_reader tokens: Array[String]
|
|
16
|
+
|
|
17
|
+
attr_reader canonical: witness_status
|
|
18
|
+
|
|
19
|
+
attr_reader target: witness_status
|
|
20
|
+
|
|
21
|
+
# @rbs (entry: String, tokens: Array[String], canonical: witness_status,
|
|
22
|
+
# target: witness_status) -> void
|
|
23
|
+
def initialize: (entry: String, tokens: Array[String], canonical: witness_status, target: witness_status) -> void
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class Result
|
|
27
|
+
attr_reader differences: Array[Difference]
|
|
28
|
+
|
|
29
|
+
attr_reader explored: Integer
|
|
30
|
+
|
|
31
|
+
attr_reader truncated: bool
|
|
32
|
+
|
|
33
|
+
attr_reader max_tokens: Integer
|
|
34
|
+
|
|
35
|
+
attr_reader max_cases: Integer
|
|
36
|
+
|
|
37
|
+
# @rbs (differences: Array[Difference], explored: Integer, truncated: bool,
|
|
38
|
+
# max_tokens: Integer, max_cases: Integer) -> void
|
|
39
|
+
def initialize: (differences: Array[Difference], explored: Integer, truncated: bool, max_tokens: Integer, max_cases: Integer) -> void
|
|
40
|
+
|
|
41
|
+
# @rbs () -> bool
|
|
42
|
+
def ok?: () -> bool
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @rbs (IR::Grammar grammar, IR::Automaton target, ?max_tokens: Integer,
|
|
46
|
+
# ?max_cases: Integer, ?max_states: Integer, ?max_items: Integer) -> void
|
|
47
|
+
def initialize: (IR::Grammar grammar, IR::Automaton target, ?max_tokens: Integer, ?max_cases: Integer, ?max_states: Integer, ?max_items: Integer) -> void
|
|
48
|
+
|
|
49
|
+
# @rbs () -> Result
|
|
50
|
+
def verify: () -> Result
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
# @rbs () -> Array[IR::GrammarSymbol]
|
|
55
|
+
def input_tokens: () -> Array[IR::GrammarSymbol]
|
|
56
|
+
|
|
57
|
+
# @rbs (String, Array[Integer], Array[Difference], Integer) -> [Integer, bool]
|
|
58
|
+
def verify_entry: (String, Array[Integer], Array[Difference], Integer) -> [ Integer, bool ]
|
|
59
|
+
|
|
60
|
+
# @rbs (Integer id) -> String
|
|
61
|
+
def token_name: (Integer id) -> String
|
|
62
|
+
|
|
63
|
+
# @rbs (String entry, Array[Integer]) -> witness_status
|
|
64
|
+
def simulate_target: (String entry, Array[Integer]) -> witness_status
|
|
65
|
+
|
|
66
|
+
# Canonical collection is intentionally built here rather than through
|
|
67
|
+
# the production construction entry point, keeping this witness
|
|
68
|
+
# independent from construction code.
|
|
69
|
+
class CanonicalMachine
|
|
70
|
+
# @rbs (IR::Grammar grammar, max_states: Integer, max_items: Integer) -> void
|
|
71
|
+
def initialize: (IR::Grammar grammar, max_states: Integer, max_items: Integer) -> void
|
|
72
|
+
|
|
73
|
+
# @rbs (String entry, Array[Integer]) -> witness_status
|
|
74
|
+
def simulate: (String entry, Array[Integer]) -> witness_status
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
# @rbs (ReferenceCollection::Collection) -> Array[IR::AutomatonState]
|
|
79
|
+
def build_states: (ReferenceCollection::Collection) -> Array[IR::AutomatonState]
|
|
80
|
+
|
|
81
|
+
# @rbs (ReferenceCollection::Collection, Set[Array[Integer]], Integer) -> IR::AutomatonState
|
|
82
|
+
def build_state: (ReferenceCollection::Collection, Set[Array[Integer]], Integer) -> IR::AutomatonState
|
|
83
|
+
|
|
84
|
+
# @rbs (Array[IR::AutomatonItem], Hash[Integer, Integer]) -> Hash[Integer, IR::parser_action]
|
|
85
|
+
def resolve_actions: (Array[IR::AutomatonItem], Hash[Integer, Integer]) -> Hash[Integer, IR::parser_action]
|
|
86
|
+
|
|
87
|
+
# @rbs (Hash[Integer, Integer]) -> Hash[Integer, Array[IR::parser_action]]
|
|
88
|
+
def transition_candidates: (Hash[Integer, Integer]) -> Hash[Integer, Array[IR::parser_action]]
|
|
89
|
+
|
|
90
|
+
# @rbs (Array[IR::AutomatonItem], Hash[Integer, Array[IR::parser_action]]) -> void
|
|
91
|
+
def completed_candidates: (Array[IR::AutomatonItem], Hash[Integer, Array[IR::parser_action]]) -> void
|
|
92
|
+
|
|
93
|
+
# @rbs (Integer production_id) -> Array[Integer]
|
|
94
|
+
def rhs_for: (Integer production_id) -> Array[Integer]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# A stack machine shared by the canonical reference and submitted IR.
|
|
98
|
+
class Machine
|
|
99
|
+
# @rbs (Array[IR::AutomatonState] states, IR::Grammar grammar) -> void
|
|
100
|
+
def initialize: (Array[IR::AutomatonState] states, IR::Grammar grammar) -> void
|
|
101
|
+
|
|
102
|
+
# @rbs (Integer initial, Array[Integer]) -> witness_status
|
|
103
|
+
def simulate: (Integer initial, Array[Integer]) -> witness_status
|
|
104
|
+
|
|
105
|
+
private
|
|
106
|
+
|
|
107
|
+
# @rbs (Array[Integer], Integer) -> witness_status
|
|
108
|
+
def consume: (Array[Integer], Integer) -> witness_status
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Generated from lib/ibex/verify/reference_collection.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module Verify
|
|
5
|
+
# Independently derives canonical LR(1) and LR(0) item collections.
|
|
6
|
+
class ReferenceCollection
|
|
7
|
+
# Immutable canonical collection and its symbol transitions.
|
|
8
|
+
class Collection
|
|
9
|
+
attr_reader states: Array[Set[Array[Integer]]]
|
|
10
|
+
|
|
11
|
+
attr_reader transitions: Array[Hash[Integer, Integer]]
|
|
12
|
+
|
|
13
|
+
# @rbs (states: Array[Set[Array[Integer]]], transitions: Array[Hash[Integer, Integer]]) -> void
|
|
14
|
+
def initialize: (states: Array[Set[Array[Integer]]], transitions: Array[Hash[Integer, Integer]]) -> void
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @rbs (IR::Grammar grammar, ?max_states: Integer, ?max_items: Integer) -> void
|
|
18
|
+
def initialize: (IR::Grammar grammar, ?max_states: Integer, ?max_items: Integer) -> void
|
|
19
|
+
|
|
20
|
+
# @rbs (Symbol kind) -> Collection
|
|
21
|
+
def build: (Symbol kind) -> Collection
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# @rbs (Array[Set[Array[Integer]]] seeds, Symbol kind) -> Collection
|
|
26
|
+
def collection: (Array[Set[Array[Integer]]] seeds, Symbol kind) -> Collection
|
|
27
|
+
|
|
28
|
+
# @rbs (Array[Set[Array[Integer]]] states, Hash[Array[Array[Integer]], Integer] indexes,
|
|
29
|
+
# Set[Array[Integer]] state) -> Integer
|
|
30
|
+
def insert_state: (Array[Set[Array[Integer]]] states, Hash[Array[Array[Integer]], Integer] indexes, Set[Array[Integer]] state) -> Integer
|
|
31
|
+
|
|
32
|
+
# @rbs (Set[Array[Integer]] seed, Symbol kind) -> Set[Array[Integer]]
|
|
33
|
+
def closure: (Set[Array[Integer]] seed, Symbol kind) -> Set[Array[Integer]]
|
|
34
|
+
|
|
35
|
+
# @rbs (Set[Array[Integer]] state, Integer symbol_id, Symbol kind) -> Set[Array[Integer]]
|
|
36
|
+
def go_to: (Set[Array[Integer]] state, Integer symbol_id, Symbol kind) -> Set[Array[Integer]]
|
|
37
|
+
|
|
38
|
+
# @rbs (Set[Array[Integer]] items, Array[Array[Integer]] queue, Array[Integer] item) -> void
|
|
39
|
+
def add_item: (Set[Array[Integer]] items, Array[Array[Integer]] queue, Array[Integer] item) -> void
|
|
40
|
+
|
|
41
|
+
# @rbs () -> void
|
|
42
|
+
def account_item: () -> void
|
|
43
|
+
|
|
44
|
+
# @rbs (Set[Array[Integer]] state) -> Array[Integer]
|
|
45
|
+
def next_symbols: (Set[Array[Integer]] state) -> Array[Integer]
|
|
46
|
+
|
|
47
|
+
# @rbs (Integer production_id, Integer dot, Integer? inherited) -> Array[Integer]
|
|
48
|
+
def closure_lookaheads: (Integer production_id, Integer dot, Integer? inherited) -> Array[Integer]
|
|
49
|
+
|
|
50
|
+
# @rbs (Integer production_id) -> Array[Integer]
|
|
51
|
+
def rhs_for: (Integer production_id) -> Array[Integer]
|
|
52
|
+
|
|
53
|
+
# @rbs (Integer production_id) -> IR::GrammarSymbol
|
|
54
|
+
def start_symbol: (Integer production_id) -> IR::GrammarSymbol
|
|
55
|
+
|
|
56
|
+
# @rbs () -> Integer
|
|
57
|
+
def eof_id: () -> Integer
|
|
58
|
+
|
|
59
|
+
# @rbs () -> Hash[Symbol, Integer]
|
|
60
|
+
def bounds: () -> Hash[Symbol, Integer]
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Generated from lib/ibex/verify/result.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module Verify
|
|
5
|
+
# One stable verifier finding.
|
|
6
|
+
class Violation
|
|
7
|
+
attr_reader id: String
|
|
8
|
+
|
|
9
|
+
attr_reader location: String
|
|
10
|
+
|
|
11
|
+
attr_reader message: String
|
|
12
|
+
|
|
13
|
+
# @rbs (id: String, location: String, message: String) -> void
|
|
14
|
+
def initialize: (id: String, location: String, message: String) -> void
|
|
15
|
+
|
|
16
|
+
# @rbs () -> Hash[Symbol, String]
|
|
17
|
+
def to_h: () -> Hash[Symbol, String]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Immutable independent-verification report.
|
|
21
|
+
class Result
|
|
22
|
+
type report_value = String | Integer | bool | Array[String] | Hash[Symbol, Integer] | Array[Hash[Symbol, String]]
|
|
23
|
+
|
|
24
|
+
attr_reader algorithm: String
|
|
25
|
+
|
|
26
|
+
attr_reader strict: bool
|
|
27
|
+
|
|
28
|
+
attr_reader checks: Array[String]
|
|
29
|
+
|
|
30
|
+
attr_reader violations: Array[Violation]
|
|
31
|
+
|
|
32
|
+
attr_reader bounds: Hash[Symbol, Integer]
|
|
33
|
+
|
|
34
|
+
# @rbs (algorithm: String, strict: bool, checks: Array[String], violations: Array[Violation],
|
|
35
|
+
# bounds: Hash[Symbol, Integer]) -> void
|
|
36
|
+
def initialize: (algorithm: String, strict: bool, checks: Array[String], violations: Array[Violation], bounds: Hash[Symbol, Integer]) -> void
|
|
37
|
+
|
|
38
|
+
# @rbs () -> bool
|
|
39
|
+
def valid?: () -> bool
|
|
40
|
+
|
|
41
|
+
# @rbs () -> Hash[Symbol, report_value]
|
|
42
|
+
def to_h: () -> Hash[Symbol, report_value]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class BudgetExceeded < Ibex::Error
|
|
46
|
+
attr_reader bounds: Hash[Symbol, Integer]
|
|
47
|
+
|
|
48
|
+
# @rbs (String message, bounds: Hash[Symbol, Integer]) -> void
|
|
49
|
+
def initialize: (String message, bounds: Hash[Symbol, Integer]) -> void
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Generated from lib/ibex/verify/verifier.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Ibex
|
|
4
|
+
module Verify
|
|
5
|
+
# Checks Automaton IR semantics against an independently derived collection.
|
|
6
|
+
# rubocop:disable Metrics/ClassLength -- V1-V9 share one violation and item-identity model.
|
|
7
|
+
class Verifier
|
|
8
|
+
DEFAULT_CHECKS: Array[String]
|
|
9
|
+
|
|
10
|
+
STRICT_CHECKS: Array[String]
|
|
11
|
+
|
|
12
|
+
ERROR_ACTION: IR::error_action
|
|
13
|
+
|
|
14
|
+
# @rbs (IR::Automaton automaton, ?strict: bool, ?max_states: Integer, ?max_items: Integer) -> void
|
|
15
|
+
def initialize: (IR::Automaton automaton, ?strict: bool, ?max_states: Integer, ?max_items: Integer) -> void
|
|
16
|
+
|
|
17
|
+
# @rbs () -> Result
|
|
18
|
+
def verify: () -> Result
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
# V9 is a bounded semantic witness for IELR only. It deliberately does
|
|
23
|
+
# not replace V1/V2 or claim unbounded language equivalence.
|
|
24
|
+
# @rbs () -> void
|
|
25
|
+
def verify_ielr_adequacy: () -> void
|
|
26
|
+
|
|
27
|
+
# @rbs () -> void
|
|
28
|
+
def verify_grammar_digest: () -> void
|
|
29
|
+
|
|
30
|
+
# @rbs () -> void
|
|
31
|
+
def verify_item_collection: () -> void
|
|
32
|
+
|
|
33
|
+
# SLR lookaheads affect completed items only. The builder may retain
|
|
34
|
+
# propagation lookaheads on non-completed items, but they cannot select
|
|
35
|
+
# an ACTION cell and therefore are outside the SLR semantic contract.
|
|
36
|
+
# @rbs (Array[Set[Array[Integer]]] expected_states) -> void
|
|
37
|
+
def compare_slr_states: (Array[Set[Array[Integer]]] expected_states) -> void
|
|
38
|
+
|
|
39
|
+
# @rbs (IR::AutomatonState state,
|
|
40
|
+
# Hash[Array[Array[Integer]], Array[Set[Array[Integer]]]] expected_by_core) ->
|
|
41
|
+
# Array[Array[Integer]]?
|
|
42
|
+
def verify_slr_state: (IR::AutomatonState state, Hash[Array[Array[Integer]], Array[Set[Array[Integer]]]] expected_by_core) -> Array[Array[Integer]]?
|
|
43
|
+
|
|
44
|
+
# @rbs (IR::AutomatonState state, IR::AutomatonItem item) -> void
|
|
45
|
+
def verify_slr_lookaheads: (IR::AutomatonState state, IR::AutomatonItem item) -> void
|
|
46
|
+
|
|
47
|
+
# @rbs () -> Array[Set[Array[Integer]]]
|
|
48
|
+
def lr1_states: () -> Array[Set[Array[Integer]]]
|
|
49
|
+
|
|
50
|
+
# @rbs () -> Array[Set[Array[Integer]]]
|
|
51
|
+
def lalr_states: () -> Array[Set[Array[Integer]]]
|
|
52
|
+
|
|
53
|
+
# @rbs () -> Array[Set[Array[Integer]]]
|
|
54
|
+
def canonical_lr1_states: () -> Array[Set[Array[Integer]]]
|
|
55
|
+
|
|
56
|
+
# @rbs (Array[Set[Array[Integer]]] expected_states) -> void
|
|
57
|
+
def compare_expected_states: (Array[Set[Array[Integer]]] expected_states) -> void
|
|
58
|
+
|
|
59
|
+
# @rbs (Array[Set[Array[Integer]]] expected_states) -> void
|
|
60
|
+
def compare_ielr_states: (Array[Set[Array[Integer]]] expected_states) -> void
|
|
61
|
+
|
|
62
|
+
# @rbs () -> void
|
|
63
|
+
def verify_transitions_and_actions: () -> void
|
|
64
|
+
|
|
65
|
+
# @rbs (IR::AutomatonState state) -> void
|
|
66
|
+
def verify_transition_items: (IR::AutomatonState state) -> void
|
|
67
|
+
|
|
68
|
+
# @rbs (IR::AutomatonState state) -> void
|
|
69
|
+
def verify_state_actions: (IR::AutomatonState state) -> void
|
|
70
|
+
|
|
71
|
+
# @rbs (IR::AutomatonState state, IR::GrammarSymbol terminal, Array[IR::parser_action] expected,
|
|
72
|
+
# IR::parser_action actual, Array[Integer] conflict_tokens) -> void
|
|
73
|
+
def verify_terminal_action: (IR::AutomatonState state, IR::GrammarSymbol terminal, Array[IR::parser_action] expected, IR::parser_action actual, Array[Integer] conflict_tokens) -> void
|
|
74
|
+
|
|
75
|
+
# @rbs (IR::AutomatonState state, IR::GrammarSymbol terminal, IR::parser_action actual) -> void
|
|
76
|
+
def verify_error_cell: (IR::AutomatonState state, IR::GrammarSymbol terminal, IR::parser_action actual) -> void
|
|
77
|
+
|
|
78
|
+
# @rbs (IR::AutomatonState state, IR::GrammarSymbol terminal, IR::parser_action expected,
|
|
79
|
+
# IR::parser_action actual) -> void
|
|
80
|
+
def verify_single_action: (IR::AutomatonState state, IR::GrammarSymbol terminal, IR::parser_action expected, IR::parser_action actual) -> void
|
|
81
|
+
|
|
82
|
+
# @rbs (IR::AutomatonState state, IR::GrammarSymbol terminal, Array[IR::parser_action] expected,
|
|
83
|
+
# IR::parser_action actual, Array[Integer] conflict_tokens) -> void
|
|
84
|
+
def verify_conflicted_action: (IR::AutomatonState state, IR::GrammarSymbol terminal, Array[IR::parser_action] expected, IR::parser_action actual, Array[Integer] conflict_tokens) -> void
|
|
85
|
+
|
|
86
|
+
# @rbs () -> void
|
|
87
|
+
def verify_table_formats: () -> void
|
|
88
|
+
|
|
89
|
+
# @rbs (Tables::action_table table, Integer row) -> Hash[Integer, IR::runtime_action]
|
|
90
|
+
def action_row: (Tables::action_table table, Integer row) -> Hash[Integer, IR::runtime_action]
|
|
91
|
+
|
|
92
|
+
# @rbs (Tables::goto_table table, Integer row) -> Hash[Integer, untyped]
|
|
93
|
+
def goto_row: (Tables::goto_table table, Integer row) -> Hash[Integer, untyped]
|
|
94
|
+
|
|
95
|
+
# @rbs () -> void
|
|
96
|
+
def verify_reachability_and_productivity: () -> void
|
|
97
|
+
|
|
98
|
+
# @rbs () -> void
|
|
99
|
+
def verify_epsilon_termination: () -> void
|
|
100
|
+
|
|
101
|
+
# @rbs () -> void
|
|
102
|
+
def verify_conflict_determinism: () -> void
|
|
103
|
+
|
|
104
|
+
# @rbs (IR::AutomatonState state, IR::conflict conflict) -> void
|
|
105
|
+
def verify_conflict_resolution: (IR::AutomatonState state, IR::conflict conflict) -> void
|
|
106
|
+
|
|
107
|
+
# @rbs (IR::conflict conflict) -> Array[IR::parser_action]
|
|
108
|
+
def conflict_candidates: (IR::conflict conflict) -> Array[IR::parser_action]
|
|
109
|
+
|
|
110
|
+
# @rbs (IR::conflict conflict) -> IR::parser_action?
|
|
111
|
+
def resolved_conflict_action: (IR::conflict conflict) -> IR::parser_action?
|
|
112
|
+
|
|
113
|
+
# @rbs (IR::AutomatonState state) -> Hash[Integer, Array[IR::parser_action]]
|
|
114
|
+
def action_candidates: (IR::AutomatonState state) -> Hash[Integer, Array[IR::parser_action]]
|
|
115
|
+
|
|
116
|
+
# @rbs (IR::AutomatonState state, Integer symbol_id) -> Array[Array[Integer]]
|
|
117
|
+
def shifted_items: (IR::AutomatonState state, Integer symbol_id) -> Array[Array[Integer]]
|
|
118
|
+
|
|
119
|
+
# @rbs (IR::AutomatonState state, Integer terminal_id) -> IR::parser_action
|
|
120
|
+
def effective_action: (IR::AutomatonState state, Integer terminal_id) -> IR::parser_action
|
|
121
|
+
|
|
122
|
+
# @rbs () -> Set[Integer]
|
|
123
|
+
def reachable_states: () -> Set[Integer]
|
|
124
|
+
|
|
125
|
+
# @rbs () -> Set[Integer]
|
|
126
|
+
def productive_nonterminals: () -> Set[Integer]
|
|
127
|
+
|
|
128
|
+
# @rbs (Hash[Integer, Integer] edges) -> bool
|
|
129
|
+
def directed_cycle?: (Hash[Integer, Integer] edges) -> bool
|
|
130
|
+
|
|
131
|
+
# @rbs (IR::AutomatonState state) -> Set[Array[Integer]]
|
|
132
|
+
def expanded_items: (IR::AutomatonState state) -> Set[Array[Integer]]
|
|
133
|
+
|
|
134
|
+
# Automaton IR intentionally exposes every augmented production as -1,
|
|
135
|
+
# even when construction internally assigned one per start symbol.
|
|
136
|
+
# @rbs (Set[Array[Integer]] state) -> Set[Array[Integer]]
|
|
137
|
+
def visible_state: (Set[Array[Integer]] state) -> Set[Array[Integer]]
|
|
138
|
+
|
|
139
|
+
# @rbs (Set[Array[Integer]] state) -> Array[Array[Integer]]
|
|
140
|
+
def core_key: (Set[Array[Integer]] state) -> Array[Array[Integer]]
|
|
141
|
+
|
|
142
|
+
# @rbs (Array[Set[Array[Integer]]] states) -> Hash[Array[Array[Integer]], Integer]
|
|
143
|
+
def multiset: (Array[Set[Array[Integer]]] states) -> Hash[Array[Array[Integer]], Integer]
|
|
144
|
+
|
|
145
|
+
# @rbs (Integer production_id) -> Array[Integer]
|
|
146
|
+
def follow_ids: (Integer production_id) -> Array[Integer]
|
|
147
|
+
|
|
148
|
+
# @rbs (Integer production_id) -> Array[Integer]
|
|
149
|
+
def rhs_for: (Integer production_id) -> Array[Integer]
|
|
150
|
+
|
|
151
|
+
# @rbs (Integer production_id) -> IR::GrammarSymbol
|
|
152
|
+
def start_symbol: (Integer production_id) -> IR::GrammarSymbol
|
|
153
|
+
|
|
154
|
+
# @rbs () -> Integer
|
|
155
|
+
def eof_id: () -> Integer
|
|
156
|
+
|
|
157
|
+
# @rbs () -> Array[Integer]
|
|
158
|
+
def start_symbol_ids: () -> Array[Integer]
|
|
159
|
+
|
|
160
|
+
# @rbs () -> ReferenceCollection
|
|
161
|
+
def reference: () -> ReferenceCollection
|
|
162
|
+
|
|
163
|
+
# @rbs (String id, String location, String message) -> void
|
|
164
|
+
def violation: (String id, String location, String message) -> void
|
|
165
|
+
|
|
166
|
+
# @rbs (IR::AutomatonState state) -> String
|
|
167
|
+
def state_path: (IR::AutomatonState state) -> String
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|