Add try-catch-finally support: parse and generate opcodes for this construct

Fix varg generation: generate *_n opcodes with parameters in following meta opcodes
Add stack internal structure: dimanically allocated stack.
Use dynamically allocated memory in parser: every local and global variables are stored in dinamically allocated stacks.
Use dynamically allocated memory in serializer: opcodes are also stored in stack.
Change is_true_jmp and is_false_jmp opcodes to relative.
Change *jmp* opcodes to be able to store opcode_counter_t instead of idx_t.
This commit is contained in:
Ilmir Usmanov
2014-09-16 21:22:11 +04:00
parent cd41b236d9
commit e77bd4f4e5
26 changed files with 1644 additions and 1710 deletions
+12 -12
View File
@@ -27,18 +27,18 @@ main( int __unused argc,
char __unused **argv)
{
const opcode_t test_program[] = {
/* 0: */ getop_reg_var_decl( 255, 255),
/* 1: */ getop_var_decl( 0),
/* 2: */ getop_var_decl( 1),
/* 3: */ getop_assignment( 0, OPCODE_ARG_TYPE_STRING, 1),
/* 4: */ getop_assignment( 1, OPCODE_ARG_TYPE_VARIABLE, 0),
/* 5: */ getop_is_true_jmp( 1, 7),
/* 6: */ getop_jmp_down( 5),
/* 7: */ getop_assignment( 0, OPCODE_ARG_TYPE_SMALLINT, 253),
/* 8: */ getop_assignment( 1, OPCODE_ARG_TYPE_NUMBER, 2),
/* 9: */ getop_is_false_jmp( 1, 11),
/* 10: */ getop_exitval( 0),
/* 11: */ getop_exitval( 1)
[ 0] = getop_reg_var_decl (255, 255),
[ 1] = getop_var_decl (0),
[ 2] = getop_var_decl (1),
[ 3] = getop_assignment (0, OPCODE_ARG_TYPE_STRING, 1),
[ 4] = getop_assignment (1, OPCODE_ARG_TYPE_VARIABLE, 0),
[ 5] = getop_is_true_jmp_down (1, 0, 2),
[ 6] = getop_jmp_down (0, 5),
[ 7] = getop_assignment (0, OPCODE_ARG_TYPE_SMALLINT, 253),
[ 8] = getop_assignment (1, OPCODE_ARG_TYPE_NUMBER, 2),
[ 9] = getop_is_false_jmp_down (1, 0, 2),
[10] = getop_exitval (0),
[11] = getop_exitval (1)
};
mem_init();