ragel

Is ANTLR an appropriate tool to serialize/deserialize a binary data format?

泪湿孤枕 提交于 2020-01-13 08:03:09
问题 I need to read and write octet streams to send over various networks to communicate with smart electric meters. There is an ANSI standard, ANSI C12.19, that describes the binary data format. While the data format is not overly complex the standard is very large (500+ pages) in that it describes many distinct types. The standard is fully described by an EBNF grammar. I am considering utilizing ANTLR to read the EBNF grammar or a modified version of it and create C# classes that can read and

Why my simple Ragel grammar use all memory and crash

耗尽温柔 提交于 2019-12-24 07:26:33
问题 I am trying to convert a set of regular expression from Adblock Plus rules into an optimized function I could call from C++. I was expecting to be able to use a lexer generator such as Ragel to do this but when I try with a very small set of Regex the memory usage go very high > 30 GB and Ragel quit without error message and without producing the output file. I included the toy grammar bellow, I am trying to understand if I am doing anything stupid that could be optimized to solve the issue.

Which Java oriented lexer parser for simple project (ANTLR, DIY, etc)

孤街醉人 提交于 2019-12-17 16:37:52
问题 I am working on a small text editor project and want to add basic syntax highlighting for a couple of languages (Java, XML..just to name a few). As a learning experience I wanted to add one of the popular or non popular Java lexer parser. What project do you recommend. Antlr is probably the most well known, but it seems pretty complex and heavy. Here are the option that I know of. Antlr Ragel (yes, it can generate Java source for processing input) Do it yourself (I guess I could write a

How do I prioritize two overlapping expressions? (Ragel)

泄露秘密 提交于 2019-12-13 00:08:29
问题 I have 2 expression : ident = alpha . (alnum|[._\-])*; string = (printable1)+; # Printable includes almost all Windows-1252 characters with glyphs. main := ( ident % do_ident | string % do_string ) # The do_* actions have been defined, and generate tokens. Obviously, any ident is a string. Ragel has priority operators to overcome this. But no matter how I've tried to set the priorities, either some idents execute both actions, or some valid strings are ignored (valid strings with a valid

Compiling errors with Ragel and C++

让人想犯罪 __ 提交于 2019-12-12 05:48:43
问题 I am trying to learn Ragel for the past 2 days and have been facing some issues related to the Ragel Syntax. My goal is to write a parser that recognizes Regex commands with C++ as host language. For now I am trying to recognize the following command with parser - :LoadSdf [0-9]+ Below is the following code I am trying: #include <iostream> #include <string.h> #include <stdio.h> %%{ action done { printf("done\n"); } machine ldf; main := (':'.'LoadSdf'.[0-9])@done; }%% %%write data; int main

Is ANTLR an appropriate tool to serialize/deserialize a binary data format?

雨燕双飞 提交于 2019-12-05 01:37:41
I need to read and write octet streams to send over various networks to communicate with smart electric meters. There is an ANSI standard, ANSI C12.19, that describes the binary data format. While the data format is not overly complex the standard is very large (500+ pages) in that it describes many distinct types. The standard is fully described by an EBNF grammar. I am considering utilizing ANTLR to read the EBNF grammar or a modified version of it and create C# classes that can read and write the octet stream. Is this a good use of ANTLR? If so, what do I need to do to be able to utilize