Sorry. I forgot to attach my little test:<div><br></div><div><div>#include <string.h></div><div>#include <stdlib.h></div><div>#include <iostream></div><div>#include <cmath></div><div><br></div><div>
<br></div><div><br></div><div>void parse(char * str)</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>char *eof = NULL;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>char *p = str; // data pointer</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>char *pe = str + strlen(str); // past end</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>int cs; // machine state</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>int len = 0;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>char token[1024];</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>static char *text_start;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>eof = pe;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>%%{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>machine parser;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>write data;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action MarkStartOfName{</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>text_start = fpc; </div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action PrintPlayerName{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>int text_len = fpc - text_start;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if (text_len > 0) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>printf("PLAYER(%.*s)\n", text_len, text_start);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>playername = lower+ >MarkStartOfName ^(space 'raises' space '$' digit+ space 'to' space '$' digit+) @PrintPlayerName ;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>#playername = any+ >MarkStartOfName ^ ' raises $1 to $2' /*(space 'raises' space '$' digit+ space 'to' space '$' digit+)*/ @PrintPlayerName ;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>main := playername;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>write init;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>write exec;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}%%</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>printf("\n");</div>
<div>}</div><div><br></div><div>int main()</div><div>{</div><div> parse("player raises $1 to $2");</div><div> getchar();</div><div>}</div></div>