3 ms·
As I said original JS syntax is pretty simple - parsing is comparable with just scanning source buffer char by char. Not too much different from HTML and CSS.
by c-smile 9y ago
As I said original JS syntax is pretty simple - parsing is comparable with just scanning source buffer char by char.
Not too much different from HTML and CSS. Where 99% of time takes actual DOM creation.
Like this XML/HTML scanner that I did while ago:
https://www.codeproject.com/Articles/14076/Fast-and-Compact-HTML-XML-Scanner-Tokenizer https://www.codeproject.com/Articles/14076/Fast-and-Compact-... - it as fast as access to memory of HTML source. It even does not allocate any memory while parsing.
- nly 9y agoWhat you're describing is a recognizer, not a parser. A parser by definition produces some output other than a boolean 'yes, this is a syntactically correct HTML/JS input' (which is still more useful than what a tokenizer/scanner gives you, which is 'yes, this thing contains only HTML/JS tokens and here they are...splat')