3 ms·
I have also recently built a regex engine. In my case it was for AssemblyScript (a new TypeScript-like language that compiles to WebAssembly). https://github.c
by ColinEberhardt 5y ago
I have also recently built a regex engine. In my case it was for AssemblyScript (a new TypeScript-like language that compiles to WebAssembly).
https://github.com/ColinEberhardt/assemblyscript-regex https://github.com/ColinEberhardt/assemblyscript-regex
I was really impressed with just how many fantastic blog posts there were that introduced the key concepts, and also how easy it was to create my own regex engine.
The bigger challenge was testing. I ended up using the PCRE test suite which I transformed into a suitable test suite for my engine:
https://github.com/ColinEberhardt/assemblyscript-regex/tree/main/spec https://github.com/ColinEberhardt/assemblyscript-regex/tree/...
- sjrd 5y agoI'm curious: what is the advantage of a custom engine over calling the JavaScript's `RegExp` via the interop layer of Wasm<->JS? I guess you'd have to convert the Wasm input string to a JS string, but is there any other issue?