Radicalc  Check-in [fd180a44da]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:mangled names
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fd180a44daf25e5f27d6f9b8300e6d7b85c415320ef72f1f7f19cdfc5ddffb55
User & Date: athaudia 2017-07-13 00:33:28.957
Context
2017-07-13
08:46
forgot { in output check-in: 5dd83026e9 user: athaudia tags: trunk
00:33
mangled names check-in: fd180a44da user: athaudia tags: trunk
00:26
annotate expressions and function calls check-in: c163bb063c user: athaudia tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to bootstrap/main.c.
470
471
472
473
474
475
476

477
478
479
480
481
482
483
					printf("%s", params[i]->name);
					if(i < node->child_count-1)
						printf(", ");
				}
				printf(") not found but used\n");
				exit(-1);
			}

			node->data_type = fun->return_type;
			break;
		}
		case NODE_FUNBODY:
			break;
		default:
			printf("error, not yet annotating %i\n", node->type);







>







470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
					printf("%s", params[i]->name);
					if(i < node->child_count-1)
						printf(", ");
				}
				printf(") not found but used\n");
				exit(-1);
			}
			node->fun = fun;
			node->data_type = fun->return_type;
			break;
		}
		case NODE_FUNBODY:
			break;
		default:
			printf("error, not yet annotating %i\n", node->type);
513
514
515
516
517
518
519





520
521
522
523
524
525
526
527
528
529
530

531
532
533
534
535
536
537
538
}


void print_data_type(struct data_type* data_type) {
	printf("%s", data_type->name);
}







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");
			}
			break;
		case NODE_FUNCALL:
			print_indent(indent);

			printf("%s(\n", node->name);
			for(int j = 0; j < node->child_count; ++j) {
				print_tree(node->childs[j], indent+1);
				if(j < node->child_count-1)
					printf(",\n");
				else
					printf("\n");
			}







>
>
>
>
>











>
|







514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
}


void print_data_type(struct data_type* data_type) {
	printf("%s", data_type->name);
}

void print_mangled_function_name(struct function* fun) {
	printf("%s__%s", fun->name, fun->return_type->name);
	for(int i = 0; i < fun->param_count; ++i)
		printf("__%s", fun->params[i].data_type->name);
}

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");
			}
			break;
		case NODE_FUNCALL:
			print_indent(indent);
			print_mangled_function_name(node->fun);
			printf("(\n");
			for(int j = 0; j < node->child_count; ++j) {
				print_tree(node->childs[j], indent+1);
				if(j < node->child_count-1)
					printf(",\n");
				else
					printf("\n");
			}
552
553
554
555
556
557
558
559


560
561
562
563
564
565
566
	}
}

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");







|
>
>







559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
	}
}

void print_functions() {
	for(int i = 0; i < function_count; ++i) {
		struct function* fun = functions[i];
		print_data_type(fun->return_type);
		printf(" ");
		print_mangled_function_name(fun);
		printf("(");
		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");
Changes to bootstrap/test.rcs.
1
2
3
4
5
6
7
8
9
10
11
fun add(a:i32, b:i32):i32
end

fun print(a:i32, b:i32, c:i16)
end

fun	main()
	print(10,20,add(15,15))
end





|







1
2
3
4
5
6
7
8
9
10
11
fun add(a:i32, b:i32):i32
end

fun print(a:i32, b:i32, c:i32)
end

fun	main()
	print(10,20,add(15,15))
end