A new Javascript HTML parser
A pure Javascript HTML parser, by the author of jQuerry.
A pure Javascript HTML parser, by the author of jQuerry.
The ACCENT compiler compiler has fewer grammar expression restrictions than standard generators, and supports EBNF.
Here’s another feature-rich BNF converter, able to generate multiple lexers, parsers, documentation, and even pretty-printers.
Perl Cannot Be Parsed: A Formal Proof, a proof of the impossible complexity of Perl’s syntax. It’s a deep, flexible grammar, that can be extended by its delegates.
BUS is a simple interactive fiction engine written in Python. It includes a basic world model and NL parser.
A Perl6 parser written in Perl6 (coded by Mr. Larry Wall himself).
A Lemon parser generator tutorial, which is the parser generator used by SQLite. See the Lemon parser home to learn more.
It’s one of those regex-laden days, and I’m really starting to grok more complicated expressions:
^(?:\s+|)<(\w+)(?:\s+|)((?:.*?|))>(.*?)(?:<\/(.*?)>|)(?:\s+|)$
This expression parses a line that contains HTML tags based on the following logic, expecting that:
The expression will parse the following example into 4 parts:
<h1 id="test">This is a test</h1>
Learning regex to the point of being able to write complex expressions has taken a couple of years, but has been well worth the effort. To define the same parsing logic in C or C++ (using standard mechanisms) would take 20-30 minutes, and would occupy a page of code. You just have to remember that a regex is a small script, and that it should be tested (and documented) like one.
Regex is like a lot of little languages too (like SQL, bash, m4). It’s terribly useful, succinct, and worth having in your toolkit. It’s not something to hide in layers of abstraction either, rather it’s something that deserves use alongside your ‘real’ tools. I find that developers are in the habit of hiding (or hiding from) little languages, something that results in the too-many-elbows syndrome: insulating yourself from the real power of your tools, making things more complicated in the process.
Simple, in the end, is in the knowledge of the beholder. If you understand regex, code that contains it can be simpler.
A few more improvements for my SimpleLink WordPress plugin …
_ parsing bug ([Markdown] was munging underscores, now plays nicer with Markdown)You can download wp-simplelink-0.4.tar.gz, or visit the SimpleLink page for more details.