[ragel] Binary data and bits

Adrian Thurston thurston at colm.net
Sat Sep 30 15:38:21 UTC 2017


    
Looks like you accept all bytes so you don't really need ragel for that. Just need to mask and shift the bits.


--Adrian D. ThurstonChief ScientistColm Networkshttp://colm.net

-------- Original message --------
From: sothy shan <sothy.e98 at gmail.com> 
Date: 2017-09-30  6:43 AM  (GMT-05:00) 
To: ragel at colm.net 
Subject: Re: [ragel] Binary data and bits 

Thanks Adrain,

I am new to Ragel. I have one question. 
One BYTE information: 010 1 1 000
I need to take firrst three bits into one int, other two bits are two boolean values and other three are together for one int.

How to write grammar for parsing this data?

Thanks for your help.

Best regards
Sothy

On Fri, Sep 29, 2017 at 10:08 PM, Adrian Thurston <thurston at colm.net> wrote:


Hi Sothy, you need to specify the grammar at the byte level. You can union bit patterns together, however.
On 2017-09-27 15:35, sothy shan wrote:






Hi,
I need to parse 4 bytes of data and some bits of data has valid information.
How can I go with Ragel?
I am going to use Ragel with  C++.


Best regards
Sothy




_______________________________________________
ragel mailing list
ragel at colm.net
http://www.colm.net/cgi-bin/mailman/listinfo/ragel




_______________________________________________

ragel mailing list

ragel at colm.net

http://www.colm.net/cgi-bin/mailman/listinfo/ragel




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20170930/0b29526d/attachment-0002.html>


More information about the ragel-users mailing list