[ragel-users] combining ragel and lemon

Adrian Thurston thurston at colm.net
Wed Oct 16 19:26:21 EDT 2019


Just omits the static vars. So long as you are not checking final state status or if in the error state you can safely omit them.




Get Outlook for Android







On Wed, Oct 16, 2019 at 8:24 PM -0300, "Rajeev Bharol" <rajeev at arable.com> wrote:










Hi Adrian
The following:%% write data noentry noerror nofinal;

Fixes all my errors. Will it have any unintended consequences?
regards

On Tue, Oct 15, 2019 at 9:09 PM Rajeev Bharol <rajeev at arable.com> wrote:
Thanks Adrian,
With write data noentry;
Three variables ie., json_en_main, json_en_rest_object, json_en_rest_array are not created anymore. However, the variables json_error and json_first_final are still created, and hence GCC still complains. Any remedy for these?

build/json.c:265:18: error: 'json_error' defined but not used [-Werror=unused-const-variable=]
 static const int json_error = 0;
                  ^~~~~~~~~~
build/json.c:264:18: error: 'json_first_final' defined but not used [-Werror=unused-const-variable=]
 static const int json_first_final = 61;
                  ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors



regardsRajeev



On Tue, Oct 15, 2019 at 4:11 AM Adrian Thurston <thurston at colm.net> wrote:
Hi Rajeev,



Those are entry points you can use during initialization to start 

parsing somewhere other than "main". You can also use them to jump to 

other parts from action code. To remove them from output use the noentry 

write option to the write data command:



write data noentry;



Adrian



On 2019-10-14 15:04, Rajeev Bharol wrote:

> Hi

> I am using ragel 6.10 and it generates following unused variables that

> GCC compiler complains about. Is it a bug.

> 

> static const int json_en_rest_array = 12;

> static const int json_en_rest_object = 32;

> static const int json_en_main = 1;

> 

> Thanks

> Rajeev

> 

> On Fri, Aug 16, 2019 at 10:07 AM Mark Olesen

> <Mark.Olesen at esi-group.com> wrote:

> 

>> I've use ragel in a few places already for parsing, but now I'm

>> looking

>> to port over a medium sized chunk of flex/bison. Perhaps going for a

>> 

>> ragel/lemon combination.

>> 

>> According to the lemon docs

>> (https://www.hwaci.com/sw/lemon/lemon.html)

>> the parser is the one calling the lexer. But this seems to be the

>> same

>> as ragel would like to be doing: match a pattern, call an action.

>> 

>> The few examples of ragel/lemon that I've found (the classic

>> calculator,

>> or a json parser) seem to be handling this by running ragel as the

>> scanner, and calling the lemon parser in its actions.

>> 

>> Some other examples I've seen use re2c for the lexing part. This

>> appears

>> to fit better with what lemon expects, but there must be some way to

>> lex

>> a single token and return from ragel I suspect.

>> 

>> I would be thankful for ideas.

>> 

>> Cheers,

>> /mark

>> _______________________________________________

>> ragel-users mailing list

>> ragel-users at colm.net

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

> _______________________________________________

> ragel-users mailing list

> ragel-users at colm.net

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



-- 

Dr. Adrian D. Thurston

Chief Scientist

Colm Networks

http://colm.net/



_______________________________________________

ragel-users mailing list

ragel-users at colm.net

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








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20191016/313de2d0/attachment.html>


More information about the ragel-users mailing list