Character escapes in token definitions?

6 views
Skip to first unread message

David Wahlstedt

unread,
Jun 4, 2024, 11:50:19 AM6/4/24
to BNFC Developers and Users
Hello,

I want to be able to define tokens that recognize characters in a way that I couldn't find in BNFC. It would be nice to have character escapes like in Haskell, a la '\173' (soft hyphen). It would also be nice to be able to specify character classes, like [\xff-\xffff], for the range of UTF characters with codes between 255 and 65535. To specify this range in current BNFC would require a very long string, and moreover, non-printable characters can't be specified other than taking (char - ["<very long list of printable chars>"]). 

Is this in the pipeline, or what would be a possible workaround? Modifying the generated lexer code?

Best,
David

Reply all
Reply to author
Forward
0 new messages