[ragel-users] Best practice: using ragel for bit-based state machines on microcontroller?
Adrian Thurston
thurston at complang.org
Fri May 15 02:37:31 UTC 2009
I wish I had some tips for you. I have no experience using Ragel for
bit-based parsers. I know it's pretty easy to mask out high bits using
ranges
alphtype unsigned char;
foo = 0xfc .. 0xff;
But masking out low bit patterns is not pleasant because the values are
not contiguous.
Also, once you mask out some bits, you just move over the others in the
byte. I suppose you could use fhold strategically. Seems painful to me
though.
-Adrian
Jan Sporbeck wrote:
> Hello there!
>
> I'd like to use ragel to design the state machine for a microcontroller
> project (avr atmega8535) written in C.
>
> I think I understand how to use it for streams of char, int, etc. But
> what's the best practice to use for bit based decisions?
>
> I could use union..struct to pack all bits in one datatype and process
> that. But I doubt that'll yield a performant implementation.
>
> I read messages on this list that ragel is used for uC projects, but no
> details how.
>
> So any hints or example code to get me started is appreciated.
>
> Thanks in advance,
> /Jan.
>
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users
More information about the ragel-users
mailing list