I might implement these features
actually I am working on advanced lexer, planning to support an advanced interpreter (with functions, type checking, etc)
Code:
# eval 1+(2.2*3.0E9+ ( 0xdeadbeaf logicalAnd 0xffffffff ) )
yards analysis: PASSED
stack analysis: PASSED
rpn_v[]={ 0 3 5 4 8 10 9 6 1 }
[1] 1 token_DecValue, type12
[2.2] 1 token_FloatinPointENGValue, type15
[3.0E9] 1 token_FloatinPointSCIValue, type16
[*] -1 token_Asterisk, type55
[0xdeadbeaf] 1 token_HexValue, type13
[0xffffffff] 1 token_HexValue, type13
[logicalAnd] -1 token_LogicalAnd, type41
[+] -1 token_Plus, type53
[+] -1 token_Plus, type53
#########################
# good expression #
#########################
Code:
# eval 1.1 + 2.2 * 3.0E9
yards analysis: PASSED
stack analysis: PASSED
rpn_v[]={ 0 2 4 3 1 }
[1.1] 1 token_FloatinPointENGValue, type15
[2.2] 1 token_FloatinPointENGValue, type15
[3.0E9] 1 token_FloatinPointSCIValue, type16
[*] -1 token_Asterisk, type55
[+] -1 token_Plus, type53
#########################
# good expression #
#########################
Code:
# eval 1+2+
yards analysis: PASSED
stack analysis: FAILED
#########################
# bad expression #
#########################
Code:
# eval 1+2+(2+3
Error: parentheses mismatched/case1
yards analysis: FAILED
stack analysis: PASSED
#########################
# bad expression #
#########################
Code:
# eval Fa(Fb(1,2,3,4,5),Fc(6,7,8,9),0)
yards analysis: PASSED
stack analysis: PASSED
function_pool has 3 functions
+ function1 [Fa] { typeRet typeRet type12 } 3 args
+ function2 [Fb] { type12 type12 type12 type12 type12 } 5 args
+ function3 [Fc] { type12 type12 type12 type12 } 4 args
rpn_v[]={ 4 6 8 10 12 2 17 19 21 23 15 26 0 }
[1] 1 token_DecValue, type12
[2] 1 token_DecValue, type12
[3] 1 token_DecValue, type12
[4] 1 token_DecValue, type12
[5] 1 token_DecValue, type12
[Fb] -4 token_StrictAlphaNum, type19
[6] 1 token_DecValue, type12
[7] 1 token_DecValue, type12
[8] 1 token_DecValue, type12
[9] 1 token_DecValue, type12
[Fc] -3 token_StrictAlphaNum, type19
[0] 1 token_DecValue, type12
[Fa] -2 token_StrictAlphaNum, type19
#########################
# good expression #
#########################
I am considering the RPN method as the hypothetical way to transform a math expression into machine opcodes, crazy idea for AS. I do not like methods like
Recursive Descent.