Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple file support and executing BrainF code from a function #77

Open
Ponali opened this issue Jan 22, 2024 · 0 comments
Open

Add multiple file support and executing BrainF code from a function #77

Ponali opened this issue Jan 22, 2024 · 0 comments

Comments

@Ponali
Copy link

Ponali commented Jan 22, 2024

(feature request)
It would be nice to have a way to seperate code into files.
For example, i would make a subfolder in the BF-it folder with my code's name (let's say the name is calculator), and put multiple *.code files inside, with one called main.code
If a *.code file required another file, it would have a line that'll be like this: #import calculation.code (using .code in the line could be optional)
When it will import another file, every variable and function that is inside the file will be copied, for example:
inside calculation.code:

int square(int a){
  return a*a;
}

inside main.code:

#import calculation.code

int sqresult=0;
int num=0;
void main(){
  print("Enter a number...");
  num = readint();
  sqresult = calculation.square(num);
  print("The number ");
  printint(num);
  print(" squared is equal to ");
  printint(sqresult);
  print(".\n");
}

What would be also nice is to be able to insert BrainF code at compile time, for example:

int res = 0;
void main(){
  res = insert("++++[>++++++++<-]>[<+>-]<");
  if(res==32){
    print("BrainF insert success")
  } else {
    print("Error, res = ");
    printint(res);
    print(" and not 32.")
  }
}

(if you ever implement this, is it possible that you don't make it remove comments? thanks!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant