{"library":"reghex","title":"Reghex Parser Generator","description":"Reghex is an experimental, actively developed JavaScript parser generator that leverages the power of sticky regular expressions and runtime code generation to allow developers to quickly define and build parsers. Currently at version 3.0.2, it enables parser creation using a regex-like Domain Specific Language (DSL) within tagged template literals. Reghex offers flexibility by supporting both build-time pre-compilation via an optional Babel plugin (or `babel-plugin-macros` integration) and Just-In-Time (JIT) compilation at runtime, which incurs minimal overhead. Its core differentiator is the use of JavaScript's sticky regexes (`/y` flag) as the fundamental parsing primitive, allowing for efficient, continuous pattern matching by internally managing `lastIndex`. While still in its early stages with a potentially evolving API and a slower, feature-driven release cadence marked by major versions, it provides a unique approach to parser construction in JavaScript. Performance on older browsers like IE11 may be reduced due to its sticky regex polyfill.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install reghex"],"cli":null},"imports":["import { match, parse } from 'reghex';","{\"plugins\": [\"reghex/babel\"]}","import macro from 'reghex/macro';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { match, parse } from 'reghex';\n\n// Define a matcher for a simple word, tagged with 'name'\nconst name = match('name')`\n  ${/\\w+/}\n`;\n\n// Define a more complex matcher for a greeting pattern\nconst greeting = match('greeting')`\n  Hello,\n  ${match('person')`${/\\w+/}`}\n  !\n`;\n\n// Parse a simple string using the 'name' matcher\nconst resultName = parse(name)('world');\nconsole.log('Parsed name:', resultName); // Expected: [ \"world\", .tag = \"name\" ]\n\n// Parse a string using the 'greeting' matcher\nconst resultGreeting = parse(greeting)('Hello, John!');\nconsole.log('Parsed greeting:', resultGreeting); // Expected: [ \"John\", .tag = \"person\", ... ]","lang":"typescript","description":"This quickstart demonstrates how to define a simple parser using `match` with a tagged template literal and then use `parse` to apply it to an input string.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}