adl / hoaf

Hanoi Omega-Automata Format
14 stars 2 forks source link

Add an end marker to support streams of automata? #4

Closed adl closed 10 years ago

adl commented 10 years ago

I like pipes, so I would like to write tools that read streams of automata on input for batch processing. For instance imagine a filtering tool that reads a stream of HOA from its standard input, and output only the automata that respect some criteria.

For this it would be convenient to have a simple way to detect the end of an automaton. While the number of states is announced in the header, the number of transitions is not always known in advance. So currently if we had a stream of HOA inputs, the only way to detect the end of an automaton would be to reach EOF or the HOA: token that marks the start of the next automaton. Unfortunately it means that when we detect the end of some automaton, we have already started consuming a tokensfrom the next automaton. This makes it inconvenient to write a parser that returns the first automaton and that should be called again to parse the next automaton (because the same HOA: token would have to be used by the two calls).

An end marker would make things easier. I'm thinking something like

automaton ::= header "---" body "%%%"

but cleaner suggestions are most welcome.

xblahoud commented 10 years ago

Agree!

And what about --- again? I thing

automaton ::= header "---" body "---"

seems reasonable enough. In case of empty automaton we simply read double --- separated by a white space.

strejcek commented 10 years ago

Another solution is to make a pair tag (something like ), but I like Fanda's or your suggestion much more (in this order).