tntc -c sample.tnt
[static] [var] id(globall) : id(int32) = uint(1) ; [class] id(data1) { [class] id(ooo) {
[var] id(c) : id(uint8) ; } [var] id(name) : id(string) ; [var] id(value) : id(int32) ;
[func] id(both) ( ) { [return] id(name) $ id(value) ; } [func] id(__getindex) ( id(index)
: id(int32) ) : id(T) { [if] ( id(index) < uint(0) || id(index) >= id(m_size) ) { id(W
ARNING) ( str(array index out of bounds) ) ; [return] id(T) ( ) ; } [return] id(m_data) [ id
(index) ] ; } } [func] id(_test) ( id(a) : id(int32) ) : id(int32) { [var] id(v) : i
d(int8) = - uint(5) ; [return] int8(0) + id(a) + id(v) ; }
Inside "parse_decllist"
Inside "parse_vardecls"
Inside "parse_arglist"
Inside "parse_arg"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Out of "parse_arg" at line 1020
Out of "parse_arglist" at line 1081
Out of "parse_vardecls" at line 1518
Inside "parse_class"
Inside "parse_class"
Inside "parse_vardecls"
Inside "parse_arglist"
Inside "parse_arg"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Out of "parse_arg" at line 1020
Out of "parse_arglist" at line 1081
Out of "parse_vardecls" at line 1518
Inside "parse_vardecls"
Inside "parse_arglist"
Inside "parse_arg"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Out of "parse_arg" at line 1020
Out of "parse_arglist" at line 1081
Out of "parse_vardecls" at line 1518
Inside "parse_vardecls"
Inside "parse_arglist"
Inside "parse_arg"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Out of "parse_arg" at line 1020
Out of "parse_arglist" at line 1081
Out of "parse_vardecls" at line 1518
Inside "parse_function"
Inside "parse_arglist"
Out of "parse_arglist" at line 1081
Inside "parse_stmt"
Inside "parse_stmtlist"
Inside "parse_stmt"
Inside "parse_explist"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Entering a function from "level_exp" at line 1334
Inside "level_exp"
Out of "level_exp" at line 1459
Entering a function from "level_exp" at line 1360
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1377
Out of "level_exp" at line 1410
Out of "parse_exp" at line 1729
Out of "parse_explist" at line 1795
Out of "parse_stmt" at line 2515
Out of "parse_stmtlist" at line 2628
Out of "parse_stmt" at line 2563
Out of "parse_function" at line 2228
Inside "parse_function"
Inside "parse_arglist"
Inside "parse_arg"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Out of "parse_arg" at line 1020
Out of "parse_arglist" at line 1081
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Inside "parse_stmt"
Inside "parse_stmtlist"
Inside "parse_stmt"
Inside "parse_if"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Entering a function from "level_exp" at line 1334
Inside "level_exp"
Entering a function from "level_exp" at line 1334
Inside "level_exp"
Out of "level_exp" at line 1459
Entering a function from "level_exp" at line 1360
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1377
Out of "level_exp" at line 1410
Entering a function from "level_exp" at line 1360
Inside "level_exp"
Entering a function from "level_exp" at line 1334
Inside "level_exp"
Out of "level_exp" at line 1459
Entering a function from "level_exp" at line 1360
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1377
Out of "level_exp" at line 1410
Out of "level_exp" at line 1377
Out of "level_exp" at line 1410
Out of "parse_exp" at line 1729
Inside "parse_stmt"
Inside "parse_stmtlist"
Inside "parse_stmt"
Inside "parse_explist"
Inside "parse_exp"
Inside "parse_vardecls"
Entering a function from "parse_exp" at line 1612
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Inside "level_exp"
Entering a function from "level_exp" at line 1238
Inside "level_exp"
Out of "level_exp" at line 1459
Entering a function from "level_exp" at line 1264
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1303
Out of "parse_exp" at line 1729
Out of "parse_explist" at line 1795
Out of "parse_stmt" at line 2574
Inside "parse_stmt"
Inside "parse_explist"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Entering a function from "level_exp" at line 1238
Inside "level_exp"
Out of "level_exp" at line 1459
Entering a function from "level_exp" at line 1264
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1303
Out of "parse_exp" at line 1729
Out of "parse_explist" at line 1795
Out of "parse_stmt" at line 2515
Out of "parse_stmtlist" at line 2628
Out of "parse_stmt" at line 2563
Out of "parse_if" at line 1840
Out of "parse_stmt" at line 2414
Inside "parse_stmt"
Inside "parse_explist"
Inside "parse_exp"
Inside "parse_vardecls"
Entering a function from "parse_exp" at line 1612
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Inside "level_exp"
Entering a function from "level_exp" at line 1238
Inside "level_exp"
Out of "level_exp" at line 1459
Entering a function from "level_exp" at line 1264
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1294
Out of "parse_exp" at line 1729
Out of "parse_explist" at line 1795
Out of "parse_stmt" at line 2515
Out of "parse_stmtlist" at line 2628
Out of "parse_stmt" at line 2563
Out of "parse_function" at line 2228
Inside "parse_function"
Inside "parse_arglist"
Inside "parse_arg"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Out of "parse_arg" at line 1020
Out of "parse_arglist" at line 1081
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Inside "parse_stmt"
Inside "parse_stmtlist"
Inside "parse_stmt"
Inside "parse_vardecls"
Inside "parse_arglist"
Inside "parse_arg"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "parse_exp" at line 1729
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Entering a function from "level_exp" at line 1442
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1449
Out of "parse_exp" at line 1729
Out of "parse_arg" at line 1020
Out of "parse_arglist" at line 1081
Out of "parse_vardecls" at line 1518
Out of "parse_stmt" at line 2533
Inside "parse_stmt"
Inside "parse_explist"
Inside "parse_exp"
Inside "parse_vardecls"
Inside "level_exp"
Entering a function from "level_exp" at line 1334
Inside "level_exp"
Entering a function from "level_exp" at line 1334
Inside "level_exp"
Out of "level_exp" at line 1459
Entering a function from "level_exp" at line 1360
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1377
Out of "level_exp" at line 1410
Entering a function from "level_exp" at line 1360
Inside "level_exp"
Out of "level_exp" at line 1459
Out of "level_exp" at line 1377
Out of "level_exp" at line 1410
Out of "parse_exp" at line 1729
Out of "parse_explist" at line 1795
Out of "parse_stmt" at line 2515
Out of "parse_stmtlist" at line 2628
Out of "parse_stmt" at line 2563
Out of "parse_function" at line 2228
Out of "parse_decllist" at line 2706
BLOCK (struct=4 op=21 opsub=0 tt=75)
{
locals:
VAR (struct=2 op=54 opsub=0 tt=78)
{
name = 'globall'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
value:
uint(1) (struct=13 op=3 opsub=0 tt=86)
}
code:
{
CLASS (struct=5 op=52 opsub=0 tt=75)
{
name = 'data1'
items:
{
CLASS (struct=5 op=52 opsub=0 tt=75)
{
name = 'ooo'
items:
MEMBER (struct=2 op=55 opsub=0 tt=78)
{
name = 'c'
orig_datatype = 'uint8'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'uint8'
typeinfo: <null>
value: <null>
}
}
MEMBER (struct=2 op=55 opsub=0 tt=78)
{
name = 'name'
orig_datatype = 'string'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'string'
typeinfo: <null>
value: <null>
}
MEMBER (struct=2 op=55 opsub=0 tt=78)
{
name = 'value'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
value: <null>
}
FUNC (struct=6 op=30 opsub=0 tt=75)
{
name = 'both'
orig_datatype = ''
datatype = ''
orig_typeinfo: <null>
typeinfo: <null>
params: <null>
code:
BLOCK (struct=4 op=21 opsub=0 tt=75)
{
locals: <null>
code:
RETURN (struct=7 op=18 opsub=0 tt=78)
{
arg:
$ (struct=7 op=4 opsub=0 tt=239)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'name'
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'value'
}
}
}
}
bytecode:
}
FUNC (struct=6 op=30 opsub=0 tt=75)
{
name = '__getindex'
orig_datatype = 'T'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'T'
typeinfo: <null>
params:
ARG (struct=2 op=10 opsub=0 tt=78)
{
name = 'index'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
value: <null>
}
code:
BLOCK (struct=4 op=21 opsub=0 tt=75)
{
locals: <null>
code:
{
IF/ELSE (struct=9 op=22 opsub=0 tt=75)
{
test:
|| (struct=7 op=4 opsub=0 tt=226)
{
arg:
{
< (struct=7 op=4 opsub=0 tt=206)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'index'
uint(0) (struct=13 op=3 opsub=0 tt=86)
}
}
>= (struct=7 op=4 opsub=0 tt=205)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'index'
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'm_size'
}
}
}
}
ontrue:
BLOCK (struct=4 op=21 opsub=0 tt=78)
{
locals: <null>
code:
{
FCALL (struct=7 op=6 opsub=0 tt=40)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'WARNING'
EXPR_LIST (struct=7 op=15 opsub=0 tt=40)
{
arg:
str(array index out of bounds) (struct=13 op=3 opsub=0 tt=83)
}
}
}
RETURN (struct=7 op=18 opsub=0 tt=78)
{
arg:
FCALL (struct=7 op=6 opsub=0 tt=40)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'T'
EXPR_LIST (struct=7 op=15 opsub=0 tt=40)
{
arg: <null>
}
}
}
}
}
}
onfalse: <null>
}
RETURN (struct=7 op=18 opsub=0 tt=78)
{
arg:
INDEX (struct=7 op=7 opsub=0 tt=91)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'm_data'
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'index'
}
}
}
}
}
bytecode:
}
}
}
FUNC (struct=6 op=30 opsub=0 tt=75)
{
name = '_test'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
params:
ARG (struct=2 op=10 opsub=0 tt=78)
{
name = 'a'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
value: <null>
}
code:
BLOCK (struct=4 op=21 opsub=0 tt=75)
{
locals:
VAR (struct=2 op=54 opsub=0 tt=78)
{
name = 'v'
orig_datatype = 'int8'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int8'
typeinfo: <null>
value:
- (struct=7 op=4 opsub=0 tt=229)
{
arg:
uint(5) (struct=13 op=3 opsub=0 tt=86)
}
}
code:
RETURN (struct=7 op=18 opsub=0 tt=86)
{
arg:
+ (struct=7 op=4 opsub=0 tt=228)
{
arg:
{
+ (struct=7 op=4 opsub=0 tt=228)
{
arg:
{
int8(0) (struct=13 op=3 opsub=0 tt=86)
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'a'
}
}
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'v'
}
}
}
}
bytecode:
}
}
}
PASSED STMT op=21 struct=4
PASSED STMT op=18 struct=7
PASSED EXPR 00000000007977D0 op=4 struct=7 tok=239
PASSED EXPR 00000000007977A0 op=1 struct=12 tok=78
PASSED EXPR 0000000000797800 op=1 struct=12 tok=78
PASSED STMT op=21 struct=4
PASSED STMT op=22 struct=9
PASSED EXPR 0000000000797CD0 op=4 struct=7 tok=226
PASSED EXPR 0000000000797AC0 op=4 struct=7 tok=206
PASSED EXPR 0000000000797B50 op=1 struct=12 tok=78
PASSED EXPR 0000000000797A00 op=3 struct=13 tok=86
PASSED EXPR 0000000000797A60 op=4 struct=7 tok=205
PASSED EXPR 0000000000797C40 op=1 struct=12 tok=78
PASSED EXPR 00000000007979D0 op=1 struct=12 tok=78
PASSED STMT op=21 struct=4
PASSED STMT op=6 struct=7
PASSED STMT op=18 struct=7
PASSED EXPR 0000000000797B80 op=6 struct=7 tok=40
PASSED STMT op=18 struct=7
PASSED EXPR 0000000000798980 op=7 struct=7 tok=91
PASSED STMT op=21 struct=4
PASSED EXPR 0000000000798890 op=4 struct=7 tok=229
PASSED EXPR 0000000000798530 op=3 struct=13 tok=86
PASSED STMT op=18 struct=7
PASSED EXPR 00000000007986B0 op=4 struct=7 tok=228
PASSED EXPR 0000000000798410 op=4 struct=7 tok=228
PASSED EXPR 0000000000798380 op=3 struct=13 tok=86
PASSED EXPR 00000000007983E0 op=1 struct=12 tok=78
PASSED EXPR 0000000000798470 op=1 struct=12 tok=78
BLOCK (struct=4 op=21 opsub=0 tt=75)
{
locals: <null>
code: <null>
}
VAR (struct=2 op=54 opsub=0 tt=78)
{
name = 'globall'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
value:
uint(1) (struct=13 op=3 opsub=0 tt=86)
}
CLASS (struct=5 op=52 opsub=0 tt=75)
{
name = 'data1.ooo'
items:
MEMBER (struct=2 op=55 opsub=0 tt=78)
{
name = 'c'
orig_datatype = 'uint8'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'uint8'
typeinfo: <null>
value: <null>
}
}
FUNC (struct=6 op=30 opsub=0 tt=75)
{
name = 'data1.both'
orig_datatype = ''
datatype = ''
orig_typeinfo: <null>
typeinfo: <null>
params: <null>
code:
BLOCK (struct=4 op=21 opsub=0 tt=75)
{
locals: <null>
code:
RETURN (struct=7 op=18 opsub=0 tt=78)
{
arg:
$ (struct=7 op=4 opsub=0 tt=239)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'name'
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'value'
}
}
}
}
bytecode:
FCALL 0 [24] <= args(2): name [6], value [8]
RETURN 0 [24]
}
FUNC (struct=6 op=30 opsub=0 tt=75)
{
name = 'data1.__getindex'
orig_datatype = 'T'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'T'
typeinfo: <null>
params:
ARG (struct=2 op=10 opsub=0 tt=78)
{
name = 'index'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
value: <null>
}
code:
BLOCK (struct=4 op=21 opsub=0 tt=75)
{
locals: <null>
code:
{
IF/ELSE (struct=9 op=22 opsub=0 tt=75)
{
test:
|| (struct=7 op=4 opsub=0 tt=226)
{
arg:
{
< (struct=7 op=4 opsub=0 tt=206)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'index'
uint(0) (struct=13 op=3 opsub=0 tt=86)
}
}
>= (struct=7 op=4 opsub=0 tt=205)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'index'
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'm_size'
}
}
}
}
ontrue:
BLOCK (struct=4 op=21 opsub=0 tt=78)
{
locals: <null>
code:
{
FCALL (struct=7 op=6 opsub=0 tt=40)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'WARNING'
EXPR_LIST (struct=7 op=15 opsub=0 tt=40)
{
arg:
str(array index out of bounds) (struct=13 op=3 opsub=0 tt=83)
}
}
}
RETURN (struct=7 op=18 opsub=0 tt=78)
{
arg:
FCALL (struct=7 op=6 opsub=0 tt=40)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'T'
EXPR_LIST (struct=7 op=15 opsub=0 tt=40)
{
arg: <null>
}
}
}
}
}
}
onfalse: <null>
}
RETURN (struct=7 op=18 opsub=0 tt=78)
{
arg:
INDEX (struct=7 op=7 opsub=0 tt=91)
{
arg:
{
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'm_data'
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'index'
}
}
}
}
}
bytecode:
IF
CONST 0 [24] <= uint64 : 0000000000000000
LT 1 [27] <= index [11], 0 [24]
GTEQ 2 [28] <= index [11], m_size [13]
BLN_OR 3 [29] <= 1 [27], 2 [28]
DO
RETURN [0]
ENDO
RETURN [0]
}
CLASS (struct=5 op=52 opsub=0 tt=75)
{
name = 'data1'
items:
{
MEMBER (struct=2 op=55 opsub=0 tt=78)
{
name = 'name'
orig_datatype = 'string'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'string'
typeinfo: <null>
value: <null>
}
MEMBER (struct=2 op=55 opsub=0 tt=78)
{
name = 'value'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
value: <null>
}
}
}
FUNC (struct=6 op=30 opsub=0 tt=75)
{
name = '_test'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
params:
ARG (struct=2 op=10 opsub=0 tt=78)
{
name = 'a'
orig_datatype = 'int32'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int32'
typeinfo: <null>
value: <null>
}
code:
BLOCK (struct=4 op=21 opsub=0 tt=75)
{
locals:
VAR (struct=2 op=54 opsub=0 tt=78)
{
name = 'v'
orig_datatype = 'int8'
datatype = ''
orig_typeinfo:
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'int8'
typeinfo: <null>
value:
- (struct=7 op=4 opsub=0 tt=229)
{
arg:
uint(5) (struct=13 op=3 opsub=0 tt=86)
}
}
code:
RETURN (struct=7 op=18 opsub=0 tt=86)
{
arg:
+ (struct=7 op=4 opsub=0 tt=228)
{
arg:
{
+ (struct=7 op=4 opsub=0 tt=228)
{
arg:
{
int8(0) (struct=13 op=3 opsub=0 tt=86)
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'a'
}
}
IDENT (struct=12 op=1 opsub=0 tt=78)
name = 'v'
}
}
}
}
bytecode:
CONST 0 [24] <= uint64 : 0500000000000000
NEGATE 1 [27] <= 0 [24]
COPY 2 [28] <= 1 [27]
CONST 3 [29] <= int8 : 00
ADD 4 [32] <= 3 [29], a [18]
ADD 5 [33] <= 4 [32], v [19]
RETURN 5 [33]
}
Comments