Hacker News new | ask | show | jobs
by weinzierl 737 days ago
"- Firefox's html parser is written in Java and converted to C++ at build time."

This is surprising. Is it really true in the sense that the code that parses the HTML in a regular Firefox install was autoconverted when it was built?

1 comments

Huh, I was curious about how that was done, and it looks like it's a specialized Java to C++ converter: https://github.com/validator/htmlparser/blob/master/translat....

Looking at the source, it seems pretty easy to find Java programs that wouldn't compile correctly, but of course a fully general Java to C++ converter would be a huge undertaking. I guess with OK test coverage of the generated C++ code (which Firefox certainly has), editing the Java code remains doable.

Doesn't GWT transpile to Javascript?
Yes, that sentence is stating two different things:

> The parser core compiles on Google Web Toolkit *and* can be automatically translated into C++

Then I don't understand why GWT was mentioned. Does compiling on GWT have anything to do with the finished C++ code?