Repository navigation
Conversation
The parse_check build list now lives in firmware/tools/parse_check_sources.txt and is used by both the shell helper and the Node test. The one-time old-preprocessor differential is deleted; the #35 result is its migration record, and the C compiler is the durable oracle.
A test-only C harness dumps numeric token types, decoded values, and lines from be_lexer.c. The generator probes it for keywords, punctuation, and simple escapes, writes the static tables plus a source lock, and the conformance test compares the TypeScript stream over the real corpus and lexical edge cases. The hand-synced tables are gone, scanString is flattened, and Berry's 1. real and leading-( call forms now match the C lexer.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This is the lexer-provenance follow-up to #35. The preprocessor already parses calls into nodes and the compiler oracle already proves the generated
.bepparses. This PR makes the TypeScript lexer itself checkable against the vendored Berry lexer and removes the last hand-synced lexical tables.Changes
firmware/tools/parse_check_sources.txtnow feeds bothparse_check_examples.shand the Node oracle test.firmware/tools/lex_dump.c. A test-only harness dumps numeric token type, decoded value, and line frombe_lexer.c/be_parser.c. It uses numeric types becausebe_tokentype2stris off by one for keywords.webui/scripts/gen-lexer-tables.tsprobes the C harness for keywords, punctuation, and simple escapes, writeslexer-tables.ts, and writeslexer-source.lock. The lock hashes normalized text so Windows and Linux agree.lexer-conformance.test.ts. It compares the TypeScript token stream with the C stream over all real.befiles and a valid edge-case corpus covering both comment forms, both quote styles, every escape family, adjacent literals, line endings, call vs grouping(, and all keywords/operators. It also asserts the TS lexer reports no errors where the C lexer accepts the input.lexer.ts.scanStringis flattened intodecodeEscape+unfinishedString; the hand tables andhexValueare gone.1.is a real,1..2stays1 .. 2, trailing malformed suffixes recover like C, and a leading(is call-form (C resetshad_whitespacebefore the first token).be_lexer.h, andberry_conf.h. The README documents both native gates and the regeneration command.Verification
npm test: 201 pass, including the compiler oracle, lexer conformance, and fuzz invariants.npm run check: 0 errors (2 pre-existing Svelte warnings).node webui/scripts/gen-lexer-tables.ts: idempotent; no diff after running.firmware/tools/parse_check_examples.sh test_scripts/bench_test.be: OK.Limits
\xNNvalues above ASCII are byte strings in C but JS code points in TS; the conformance corpus keeps escaped values ASCII. DBC names are ASCII.gccand fails in CI.PR 2 will follow for the policy layer: move the argument-shape helpers to
calls.ts, add the top-level/wholeCallargument view, and extract the variable tracker toberry/tracker.ts.