Zomis / Brainduck

Brainfuck Interpreter in Java/Groovy, with a Groovy DSL
40 stars 1 forks source link

Embedded special instructions #10

Closed Zomis closed 8 years ago

Zomis commented 8 years ago

To embed assertions, debugging and other stuff, there needs to be a way to do that.

How about something like ${instructions here} ?

A problem about Brainfuck is that all non-BF characters are treated as comments, which means that it's much harder to add special meanings to certain characters.

Related to #2

Zomis commented 8 years ago

I have discussed this a bit with Mast on Code Review: http://chat.stackexchange.com/transcript/29408

It could be possible to pre-handle the code to transform non-BF characters into stuff like + - < > . , [ ] to use in Groovy (even if it might not be that clean always).

As much as possible, try to avoid using BF-chars in this code, or at least support a way to write commands without BF chars.

Additionally, #12 can check so that there are no BF-specific chars within the DSL / Groovy context.

The syntax for this is:

$ assert true

or

$ {
    assert true
}