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

Implementation of a pre-processor #6

Closed
luizperes opened this issue Jul 4, 2016 · 9 comments
Closed

Implementation of a pre-processor #6

luizperes opened this issue Jul 4, 2016 · 9 comments

Comments

@luizperes
Copy link
Member

I would like to get some pros and cons related to the use of a pre-processor on Brain. Any suggestions?

@luizperes
Copy link
Member Author

luizperes commented Jul 4, 2016

@ryukinix
Copy link
Member

ryukinix commented Jul 4, 2016

Which cases you think pre-processing can be really necessary & useful with brainfuck?

@luizperes
Copy link
Member Author

@ryukinix using macros to have the possibility to "extend" the language/ make repetitive tasks easier

@ryukinix
Copy link
Member

ryukinix commented Jul 4, 2016

Macros are really nice, but how you wish implement this? C-like syntax with #define ?

@luizperes
Copy link
Member Author

Yeah, C-style(ish) macro...
I imagine that we can do that by using pipes.
Example:

| +++++ |

Each pipe would have a number related to it... Inside the code we would call the macros like:

+ make number 1 because is the first macro
^ call macro

In this case we would need two more operators | and ^, which is bad. Do you have pros and cons?

@luizperes
Copy link
Member Author

@ryukinix I was thinking of changing a bit the code above... What if it was like that?

| number_five +++++ |
| arithmetic.brain |

In the first case, I'm creating a macro called number_five, in the second case, I'm including a file. What do you think? In this case we only need the operator pipe |

@rafaelcn
Copy link
Collaborator

rafaelcn commented Jul 6, 2016

Discussing about this feature with @luizperes in a call was revealing, while this is a nice idea it brings a bit of complexity to Brain (As it was not complex enough [literal joke here]), adding operators expands the range of errors that we could possibly get. That's one of the drawbacks, we just have to study carefully when and how to implement this great feature!

@luizperes
Copy link
Member Author

@ryukinix @rafaelcn Thinking and re-thinking, I realized that what @rafaelcn made so much sense. We should not add more complexity (more than planned) on Brain. As we want to use this language to solve AI problems as well, I do not think that we should add this new layer of complexity. Well, pointed @rafaelcn .

@luizperes
Copy link
Member Author

Anyone is welcome to re-open this discussion.

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

No branches or pull requests

3 participants