Skip to content

My fork - Sprache Binary parser #193

Description

@Serabass

Hello, I forked this repo and developing another project with it's concept.

https://github.com/Serabass/Sprache-binary

This project works in a similar way but does a different job - It helps to parse binary structures.
A simple example here:

struct RGB {
   byte R;
   byte G;
   byte B;
}

I can write a parser with Sprache's concept:

var parser = 
    from r in Parse.AnyByte
    from g in Parse.AnyByte
    from b in Parse.AnyByte
    select new RGB { R = r, G = g, B = b };

var memoryStream = new MemoryStream(new byte[] { 255, 0, 0 });
var rgb = parser.Parse(memoryStream);

Assert.Equal(255, rgb.R);
Assert.Equal(0, rgb.G);
Assert.Equal(0, rgb.B);

(I wrote a list of simple binary primitive types)

I'm using the reading of Stream instead of String input.

I'll be glad if you help me in development.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions