Dan Klishch
33b36476d9
JSSpecCompiler: Properly parse function calls with zero arguments
...
We cannot handle them normally since we need text between parenthesis to
be a valid expression. As a workaround, we now push an artificial value
to stack to act as an argument (it'll be later removed during function
call canonicalization).
2024-01-21 14:57:10 -07:00
Dan Klishch
7f47340c82
JSSpecCompiler: Create FunctionDeclaration
s for all external functions
2024-01-14 16:05:51 -07:00
Dan Klishch
0aeb7a26e9
JSSpecCompiler: Prepare for building SSA
...
This commit introduces NamedVariableDeclaration and
SSAVariableDeclaration and allows storing both of them in Variable node.
Also, it adds additional structures in FunctionDefinition and
BasicBlock, which will be used to store SSA form related information.
2024-01-04 12:06:56 -07:00
Dan Klishch
ff44aea917
JSSpecCompiler: Add control flow building pass
2023-12-14 09:06:05 -07:00
Dan Klishch
567b1f6e7c
JSSpecCompiler: Adopt more C++ terminology
...
Let's not use strange names like `ExecutionContext`, which nobody will
understand in the future.
2023-10-02 21:15:08 +02:00
Dan Klishch
4578004ad6
JSSpecCompiler: Do not frame nodes with < and > when dumping AST
...
Let's not pretend we are outputting some invalid HTML.
2023-10-02 21:15:08 +02:00
Dan Klishch
14a86c8fd6
JSSpecCompiler: Elide nested TreeList
nodes
2023-10-02 21:15:08 +02:00
Dan Klishch
67e07fa4e2
JSSpecCompiler: Introduce ControlFlowOperator nodes
2023-09-17 16:04:42 -06:00
Dan Klishch
81519975c5
JSSpecCompiler: Add reference resolving pass
...
It replaces UnresolvedReference with Variable, FunctionPointer, or
SlotName nodes. Also, it gathers all variable names from their
declarations.
2023-09-17 16:04:42 -06:00
Dan Klishch
326bac19d9
JSSpecCompiler: Make nodes inherit from Statement or Expression
...
The distinction between them will become important during CFG building.
2023-09-17 16:04:42 -06:00
Dan Klishch
4c4e1e1aed
JSSpecCompiler: Add if branch merging pass
...
It merges standalone IfBranch/ElseIfBranch nodes into IfElseIfChain
nodes. This will ease CFG generation later.
2023-09-09 11:20:43 -06:00
Dan Klishch
092ed1cc8a
JSSpecCompiler: Allow storing NullableTree
s in nodes
...
And use this in ElseIfBranch node.
2023-09-09 11:20:43 -06:00
Dan Klishch
4eede5282c
JSSpecCompiler: Allow storing error text in ErrorNode
...
This will be the main way to communicate errors from compilation passes.
2023-09-09 11:20:43 -06:00
Dan Klishch
cd8f4aaa7d
JSSpecCompiler: Introduce Function and ExecutionContext classes
...
Currently, they are not extremely useful, but the plan is to store
all function-local state in JSSpecCompiler::Function and all
"translation unit" state in ExecutionContext.
2023-09-02 19:57:06 +02:00
Dan Klishch
5846470a5f
JSSpecCompiler: Add stubs for AST types
2023-08-31 11:00:31 +02:00