cimplec / sim-c

A dynamically typed high-level front end for C

Home Page:https://cimplec.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG REPORT] return statement outside function definition

roysti10 opened this issue · comments

Describe the bug
Simc allows for return function to be outside function definition scope

To Reproduce
simc code:

fun a(){

	print("hello world")
}
return 1
MAIN
	a()
END_MAIN

c code generated:

 #include <stdio.h>

int a(void) {
	printf("hello world");
}

	return 1;

int main() {
	a();

	return 0;
}

Expected behavior
should give error stating return function used outside function definition

Desktop (please complete the following information):

  • OS: Ubuntu Linux

I would like to work on this

Sure @YJDoc2. Assigning this to you. Thanks for showing interest to contribute. Thanks @lucasace for reporting the bug.

Is one allowed to give custom return statement in main function or not?

It is not part of the current version, you are welcome to add that @YJDoc2.

Merged, thanks for your contribution @YJDoc2.