Hi Eric, On 17 January 2012 14:19, Erik Silkensen <eriksilken...@gmail.com> wrote:
> Hi Simon, > > 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... > 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: 'Remember <word>+ is <address>' -> '(remember ,$2 ,$4) 'Remember <word>+' -> '(fact ,$2) 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. 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. Simon.
____________________ Racket Users list: http://lists.racket-lang.org/users