Hi Eric,<br><br><div class="gmail_quote">On 17 January 2012 14:19, Erik Silkensen <span dir="ltr"><<a href="mailto:eriksilkensen@gmail.com">eriksilkensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Hi Simon,<div><br></div><div>I think one problem might be that 'any-string' is including whitespace. Could you define alias and fact in some way that's more specific? For example, if you had an 'id' token of just letters ((:+ alphabetic) (token-id lexeme)) then maybe your grammar is just...</div>
<div></div></div></blockquote></div><br><div>Unfortunately I'd like an alias or a fact to include whitespace. I guess for this, parser-tools would need genuine look-ahead which it doesn't seem to offer. Ideally, I'd just like to lex either 'word' or 'address' tokens and have the grammar compile these in to place, so I could express the language as:</div>
<div>'Remember <word>+ is <address>' -> '(remember ,$2 ,$4)</div><div>'Remember <word>+' -> '(fact ,$2)</div><div><br></div><div>I could probably fudge something like this in the lexer, but I'd then have to regex the lexeme to extract the relevant parts. Another problem is the parser-tools parser (and bison, for that matter) can't compile arbitrary tokens--they need to be declared beforehand, so I can't have a transformation rule 'word-token whose value is "is"', for example.</div>
<div><br></div><div>It looks like my best approach is a phalanx of regexes, so I'll give this a try. Many thanks for your reply and suggestions.</div><div>Simon.</div><div><br></div><div><br></div>