mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
LibJS: Add Javascript lexer and parser
This adds a basic Javascript lexer and parser. It can parse the currently existing demo programs. More work needs to be done to turn it into a complete parser than can parse arbitrary JS Code. The lexer outputs tokens with preceeding whitespace and comments in the trivia member. This should allow us to generate the exact source code by concatenating the generated tokens. The parser is written in a way that it always returns a complete syntax tree. Error conditions are represented as nodes in the tree. This simplifies the code and allows it to be used as an early stage parser, e.g for parsing JS documents in an IDE while editing the source code.:
This commit is contained in:
parent
17705d23fb
commit
f3a9eba987
11 changed files with 1069 additions and 36 deletions
|
@ -30,6 +30,7 @@ namespace JS {
|
|||
|
||||
class ASTNode;
|
||||
class Cell;
|
||||
class Expression;
|
||||
class Heap;
|
||||
class HeapBlock;
|
||||
class Interpreter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue