mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
1. implement simple ByteCode (load, store, binary plus)
2. implement simple ByteCodeInterpreter 3. implement simple global env we can run very simple script likes below now a = b = 1; b = a + 2; Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
3e1787dd85
commit
7c47c6ed51
41 changed files with 1622 additions and 81 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "Escargot.h"
|
||||
#include "ScriptParser.h"
|
||||
#include "runtime/Context.h"
|
||||
#include "interpreter/ByteCode.h"
|
||||
#include "parser/esprima_cpp/esprima.h"
|
||||
#include "parser/ast/AST.h"
|
||||
#include "parser/CodeBlock.h"
|
||||
|
|
@ -68,10 +69,13 @@ ScriptParser::ScriptParserResult ScriptParser::parse(StringView scriptSource)
|
|||
try {
|
||||
ProgramNode* program = esprima::parseProgram(m_context, scriptSource, [](Escargot::Node* node, NodeLOC start, NodeLOC end) {
|
||||
// printf("nd type %d\n", node->type());
|
||||
node->m_loc = start;
|
||||
});
|
||||
|
||||
CodeBlock* topCodeBlock = generateCodeBlockTreeFromAST(m_context, scriptSource, program);
|
||||
topCodeBlock->m_cachedASTNode = program;
|
||||
|
||||
script = new Script(topCodeBlock);
|
||||
// dump Code Block
|
||||
#ifndef NDEBUG
|
||||
if (getenv("DUMP_CODEBLOCK_TREE") && strlen(getenv("DUMP_CODEBLOCK_TREE"))) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue