DE-labtory / koa

The koa is a high-level language that has more expressions than the bitcoin script and is simpler and easy to analyze
Apache License 2.0
74 stars 18 forks source link

Implements compileReturnStatement and test cases #230

Closed boohyunsik closed 5 years ago

boohyunsik commented 5 years ago

resolved: #218

Implements compileReturnStatement and test cases

hihiboss commented 5 years ago

@boohyunsik Return value could be integer, string or void! So, I think you should separate their type.

If return value is integer, you should return only that integer value! If return value is string, you should return memory offset and size of that string. If return value is void, you should return memory offset and size 0. Otherwise (if return value is not integer, string or void, but expression), you should execute compileExpression() function.

boohyunsik commented 5 years ago

@boohyunsik Return value could be integer, string or void! So, I think you should separate their type.

If return value is integer, you should return only that integer value! If return value is string, you should return memory offset and size of that string. If return value is void, you should return memory offset and size 0. Otherwise (if return value is not integer, string or void, but expression), you should execute compileExpression() function.

But in compileExpression(), the cases of integer, string, boolean are already defined.

hihiboss commented 5 years ago

When compileStringExpression() is merged to develop, add the test case for string. Then, this might be merged.