WIP: import scanner.cc - transpile C++ to javascript #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "import-scanner"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
manually translating scanner.cc to tokens.js was too boring
so i started a domain-specific C++ to javascript transpiler ...
aka: why write 100 lines, when i can write 1000 lines?
currently this can transpile the trivial case,
where we have only one "entrypoint"
= only one value in enum TokenType
example: tree-sitter-cpp/src/scanner.cc
generated: scanner.js
handwritten: @lezer/cpp/src/tokens.js
detail: instead of
marker: stringi generatedelimiter: number[]maybe my version is 1% faster, because i avoid
marker.charCodeAt(i)but then
sizeof(number) > sizeof(char)so ... gotta benchmarknext steps
so currently im trying to solve the complex case
where the
Scanner.scanfunction acts as a "router" for multiple TokenTypeprobably will be something with treeshaking and function inlining ...
my code is far from "ready to merge" ... lots of dead code, debug stuff, comments
This is not something that I'm interested in maintaining, so I don't think it should live in this repository.
understandable
moving to https://github.com/milahu/lezer-parser-import-tree-sitter-scanner
Pull request closed