Radicalc  Check-in [2b6942b843]

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

Overview
Comment:annotating parameters
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2b6942b843f002b53ea6349cb6718edead1b49ba3d876c2b03052a2e4b7127dc
User & Date: athaudia 2017-07-11 01:03:37.520
Context
2017-07-13
00:26
annotate expressions and function calls check-in: c163bb063c user: athaudia tags: trunk
2017-07-11
01:03
annotating parameters check-in: 2b6942b843 user: athaudia tags: trunk
00:59
annotating data types check-in: afc06aeb77 user: athaudia tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to bootstrap/main.c.
410
411
412
413
414
415
416
417
418



419
420
421
422
423
424
425
		}
	}
	
	printf("unknown datatype '%s'\n", name);
	exit(-1);
}

void annotate_function_data_types(struct function* function) {
	annotate_data_type(&function->return_type, function->return_type_str);



}

void annotate_data_types() {
	for(int i = 0; i < function_count; ++i) {
		printf("%s\n", functions[i]->name);
		annotate_function_data_types(functions[i]);
	}







|
|
>
>
>







410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
		}
	}
	
	printf("unknown datatype '%s'\n", name);
	exit(-1);
}

void annotate_function_data_types(struct function* fun) {
	annotate_data_type(&fun->return_type, fun->return_type_str);
	for(int i = 0; i < fun->param_count; ++i) {
		annotate_data_type(&fun->params[i].data_type, fun->params[i].data_type_str);
	}
}

void annotate_data_types() {
	for(int i = 0; i < function_count; ++i) {
		printf("%s\n", functions[i]->name);
		annotate_function_data_types(functions[i]);
	}
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
		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_str);
	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");







|

<
|
<
<

|







440
441
442
443
444
445
446
447
448

449


450
451
452
453
454
455
456
457
458
		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) {

	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");
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
			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);







|


|







483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
			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);