# State machines and parsing texts

**URL:** <https://www.ruby-forum.com/t/state-machines-and-parsing-texts/175855>\
**Category:** Rails\
**Created:** [September 21, 2009, 4:19pm UTC](https://www.ruby-forum.com/t/state-machines-and-parsing-texts/175855 "2009-09-21T16:19:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fifigyuri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@Fifigyuri](https://www.ruby-forum.com/u/Fifigyuri)\
**Post date:** [September 21, 2009, 4:19pm UTC](https://www.ruby-forum.com/t/state-machines-and-parsing-texts/175855/1 "2009-09-21T16:19:13Z")

</div>

Hi, although my question is not just rails specific, I think it fits  
this discussion more than the ruby discussion.

I found a state machine package very useful (http://  
[statemachine.rubyforge.org/](http://statemachine.rubyforge.org/)). I do not know any alternatives for this.  
Do you have any tips which one could be an interesting alternative?

I used the mentioned state machine for parsing of text, which although  
has structure, but nothing nice like yml or xml… simple cut and  
paste from old application. State machines or finite state automatons  
are perhaps quite good choice for that. Do you have any ideas also for  
that what can be handy for parsing such more rough things in the  
future?

Thanks, bw, Georg

---

<div class="post-metadata">

**Author:** ![Fifigyuri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@Fifigyuri](https://www.ruby-forum.com/u/Fifigyuri)\
**Post date:** [September 21, 2009, 5:47pm UTC](https://www.ruby-forum.com/t/state-machines-and-parsing-texts/175855/2 "2009-09-21T17:47:06Z")

</div>

Fifigyuri wrote:

> Hi, although my question is not just rails specific, I think it fits  
> this discussion more than the ruby discussion.

Probably not.

> I found a state machine package very useful (http://  
> [statemachine.rubyforge.org/](http://statemachine.rubyforge.org/)). I do not know any alternatives for this.  
> Do you have any tips which one could be an interesting alternative?
> 
> I used the mentioned state machine for parsing of text, which although  
> has structure, but nothing nice like yml or xml… simple cut and  
> paste from old application. State machines or finite state automatons  
> are perhaps quite good choice for that. Do you have any ideas also for  
> that what can be handy for parsing such more rough things in the  
> future?

Parsing with state machines seems like it would be annoying. Have you  
tried Treetop?

> Thanks, bw, Georg

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
