0

Is there any way I can execute a block of code in a loop, like so:

[ some code goes here ]

Where the delimiters are "[" and "]", and also allowing for nested blocks, i.e.:

[the user can create another loop[]]

I am creating a parser for a language that implements such semantics, and it reads the code one byte/character at a time since the commands are all single characters (which is fairly important), and I am currently stuck in this loop thing.

Any help (in Python, possibly) is appreciated!

2
Contributors
2
Replies
32
Views
4 Years
Discussion Span
Last Post by 3e0jUn
0

I'm just worried that it wouldn't be happy with single-character tokens, because my syntax has some funny and weird stuff like ~++ $--#.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.