Intermediate JSON code: Link:
Intermediate format{
"types": {
"int": [ "basic",2] ,
"void": [ "basic",0] ,
"char": [ "basic",1] ,
"float": [ "basic",4] ,
"bool": [ "basic",1] ,
"array-of-chars": [ "array",0,"char"] ,
"-none-": [ "basic",2] ,
"_tt": [ "pt",2,"char"] ,
"_tt1": [ "pt",2,"char"] ,
"_tt2": [ "array",480,"int"] ,
"_tt3": [ "array",0,"char"] } ,
"globals": { "flags": "_tt2","hello": "_tt3"} ,
"functions": [{"function": "putchar","par": { "c": "int"} ,
"return": "void","mod": [ ],"body":
[ { "var": { "count": "int","timer": "int"} } ,
[ "",[ "char","*",61440] ,"=","c"] ,
[ "","c","=",[ "int","c","<<",2] ] ,
[ "","c","=",[ "int","c","|",63491] ] ,
{ "for": [ [ "","count","=",0] ,[ "bool","count","<",16] ,[ "int",
"count","=",[ "int","count","+",1] ] ] ,
"do_": [ { "asm": " movp 0x0020,A2"} ,
{ "asm": " mov D0,(A2+24)"} ,
{ "if": [ "bool","c","&",32768] ,
"then": [ { "asm": " mov D0,(A2+26)"} ] } ,
[ "","c","=",[ "int","c","<<",1] ] ,
{ "for": [ [ "","timer","=",0] ,[ "bool","timer","<",750] ,[ "int",
"timer","=",[ "int","timer","+",1] ] ] ,
"do_": [ ] } ,
{ "asm": " movp 0x0020,A2"} ,
{ "asm": " mov D0,(A2+18)"} ,
{ "for": [ [ "","timer","=",0] ,[ "bool","timer","<",750] ,[ "int",
"timer","=",[ "int","timer","+",1] ] ] ,
"do_": [ ] } ,
{ "asm": " movp 0x0020,A2"} ,
{ "asm": " mov D0,(A2+16)"} ] } ,
{ "asm": " movp 1,A2"} ]
}
,
{"function": "putdigit","par": { "n": "int","div": "int"} ,
"return": "int","mod": [ ],"body":
[ { "var": { "ch": "int"} } ,
[ "","ch","=",48] ,
{ "while": [ "bool","n",">=","div"] ,
"do_": [ [ "int","ch","=",[ "int","ch","+",1] ] ,
[ "int","n","=",[ "int","n","-","div"] ] ] } ,
[ "void","putchar",[ "ch"] ] ,
{ "return": "n"} ]
}
,
{"function": "putnumber","par": { "n": "int"} ,
"return": "void","mod": [ ],"body":
[ { "var": { } } ,
[ "","n","=",[ "int","putdigit",[ "n",10000] ] ] ,
[ "","n","=",[ "int","putdigit",[ "n",1000] ] ] ,
[ "","n","=",[ "int","putdigit",[ "n",100] ] ] ,
[ "","n","=",[ "int","putdigit",[ "n",10] ] ] ,
[ "","n","=",[ "int","putdigit",[ "n",1] ] ] ]
}
,
{"function": "putstring","par": { "s": "_tt1"} ,
"return": "void","mod": [ ],"body":
[ { "var": { } } ,
{ "while": [ "bool",[ "char","*","s"] ,"!=",0] ,
"do_": [ [ "void","putchar",[ [ "char","*","s"] ] ] ,
[ "_tt1","s","=",[ "_tt1","s","+",1] ] ] } ]
}
,
{"function": "main","par": { } ,
"return": "int","mod": [ ],"body":
[ { "var": { "i": "int","prime": "int","k": "int","count": "int",
"iter": "int","size": "int"} } ,
[ "","size","=",120] ,
[ "void","putchar",[ 42] ] ,
[ "void","putstring",[ "hello"] ] ,
{ "for": [ [ "","iter","=",1] ,[ "bool","iter","<=",10] ,[ "int",
"iter","=",[ "int","iter","+",1] ] ] ,
"do_": [ [ "","count","=",0] ,
{ "for": [ [ "","i","=",0] ,[ "bool","i","<=","size"] ,[ "int",
"i","=",[ "int","i","+",1] ] ] ,
"do_": [ [ "",[ "int","flags",":","i"] ,"=",1] ] } ,
{ "for": [ [ "","i","=",0] ,[ "bool","i","<=","size"] ,[ "int",
"i","=",[ "int","i","+",1] ] ] ,
"do_": [ { "if": [ "int","flags",":","i"] ,
"then": [ [ "","prime","=",[ "int",[ "int","i","+",
"i"] ,"+",3] ] ,
[ "void","putnumber",[ "prime"] ] ,
[ "void","putchar",[ 32] ] ,
[ "","k","=",[ "int","i","+","prime"] ] ,
{ "while": [ "bool","k","<=","size"] ,
"do_": [ [ "",[ "int","flags",":","k"] ,"=",0] ,
[ "int","k","=",[ "int","k","+","prime"] ] ] } ,
[ "","count","=",[ "int","count","+",1] ] ] } ] } ] } ]
}
] ,
"initlist": { "hello": "Hello World ! "}
}
End of JSON code.Types, globals and functions in the old internal format:Link:
(old)AST manuallist of types in the old way: