<div><div dir="auto">Can I recommend adding more examples (not just ragel code snippet, but complete recipes of minimal working examples, including command line commands, meanings of input and output, how the generated C code structure and works, etc). It must be both minimal and working. “Minimal” means, to show a point, don’t show any code more than necessary to demonstrate the point. Working means the recipe should just work, it should not require use to first understand it meaning then add some missing pieces to make it work.</div><div dir="auto"><br></div><div dir="auto">I graduately get what it means in the manual by fill in these holes myself. But It is too slow. It should not be in this way had the manual were written in a more new-user friendly manner.</div><div dir="auto"><br></div><div dir="auto">In this specific case, my understanding of its purpose is to just show some simple ragel code that will run. I’d suggest that you don’t show the “0”. If you must show it, explain what it means right after showing the example. What it should not be done is to use it but not explain it. Things like this just make the manual hard to understand, at it causes cyclic dependency.</div><div dir="auto"><br></div><div dir="auto">Dose it make sense?</div><div dir="auto"><br></div><br><div class="gmail_quote"><div>On Sat, Feb 23, 2019 at 3:39 AM Adrian Thurston <<a href="mailto:thurston@colm.net">thurston@colm.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Peng, I recommend you read a bit more of the manual. You'll find all <br>
the answers there. Thanks!<br>
<br>
On 2019-02-22 08:35, Peng Yu wrote:<br>
> Hi,<br>
> <br>
> I have a hard time to understand the exact meaning of Figure 2.1. I<br>
> understand the regex part.<br>
> <br>
> But what `0 @{ res = 1; };` means.<br>
> <br>
> How p and pe are used in `write init` and `write exec`?<br>
> <br>
> char *p = argv[1];<br>
> char *pe = p + strlen(p) + 1;<br>
> %% write init;<br>
> %% write exec;<br>
> <br>
> How to make the example on the right-hand-side of Figure 2.1 compiled? <br>
> Thanks.<br>
> <br>
> #include <string.h><br>
> #include <stdio.h><br>
> %%{<br>
> machine foo;<br>
> main :=<br>
> ( 'foo' | 'bar' )<br>
> 0 @{ res = 1; };<br>
> }%%<br>
> %% write data;<br>
> int main( int argc, char **argv )<br>
> {<br>
> int cs, res = 0;<br>
> if ( argc > 1 ) {<br>
> char *p = argv[1];<br>
> char *pe = p + strlen(p) + 1;<br>
> %% write init;<br>
> %% write exec;<br>
> }<br>
> printf("result = %i\n", res );<br>
> return 0;<br>
> }<br>
<br>
_______________________________________________<br>
ragel-users mailing list<br>
<a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
<a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a></blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Regards,<br>Peng</div>