Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | restructured data type printing |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: | 29ec2b46a7f677e7320108783cfd63580fc2922b88d89a499e9de358a674761f |
User & Date: | athaudia 2017-07-05 01:47:15 |
Context
2017-07-10
| ||
15:08 | starting to detach type name from type check-in: 5c1fe9e51e user: athaudia tags: trunk | |
2017-07-05
| ||
01:47 | restructured data type printing check-in: 29ec2b46a7 user: athaudia tags: trunk | |
01:41 | var use check-in: bc1494a7d4 user: athaudia tags: trunk | |
Changes
Changes to bootstrap/main.c.
372
373
374
375
376
377
378
379
380
381
382
383
384
385
...
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
|
for(int i = 0; i < token_len; ++i) printf("TOKEN %d %s\n", tokens[i].type, tokens[i].str); } void print_indent(int num) { for(int i = 0; i < num; ++i) printf(" "); } void print_tree(struct node* node, int indent) { switch(node->type) { case NODE_ROOT: for(int j = 0; j < node->child_count; ++j) { print_tree(node->childs[j], 0); printf("\n"); ................................................................................ printf("(UNKNOWN TOKEN)"); } } void print_functions() { for(int i = 0; i < function_count; ++i) { struct function* fun = functions[i]; printf("%s %s(", fun->return_type.name?fun->return_type.name:"void", fun->name); for(int i = 0; i < fun->param_count; ++i) { printf("%s %s", fun->params[i].data_type.name, fun->params[i].name); if(i < fun->param_count-1) printf(", "); } printf(")\n"); for(int j = 0; j < fun->body->child_count; ++j) { print_tree(fun->body->childs[j], 1); printf(";\n"); |
>
>
>
>
>
>
>
<
|
|
>
|
|
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
...
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
for(int i = 0; i < token_len; ++i) printf("TOKEN %d %s\n", tokens[i].type, tokens[i].str); } void print_indent(int num) { for(int i = 0; i < num; ++i) printf(" "); } void print_data_type(struct data_type* data_type) { if(data_type->name) printf("%s", data_type->name); else printf("void"); } void print_tree(struct node* node, int indent) { switch(node->type) { case NODE_ROOT: for(int j = 0; j < node->child_count; ++j) { print_tree(node->childs[j], 0); printf("\n"); ................................................................................ printf("(UNKNOWN TOKEN)"); } } void print_functions() { for(int i = 0; i < function_count; ++i) { struct function* fun = functions[i]; print_data_type(&fun->return_type); printf(" %s(", fun->name); for(int i = 0; i < fun->param_count; ++i) { print_data_type(&fun->params[i].data_type); printf(" %s", fun->params[i].name); if(i < fun->param_count-1) printf(", "); } printf(")\n"); for(int j = 0; j < fun->body->child_count; ++j) { print_tree(fun->body->childs[j], 1); printf(";\n"); |
Changes to bootstrap/test.rcs.
1 2 3 4 5 6 7 8 9 |
fun test(a:int, b:int):int
add(a, 1)
end
fun main():int
print(10,20,add(15,15))
end
|
| |
1 2 3 4 5 6 7 8 9 |
fun test(a:int, b:int):int add(a, 1) end fun main() print(10,20,add(15,15)) end |