Lex example doesn't work #770
Replies: 3 comments 3 replies
|
The correct way to import such module is to use The reason is that the module provides a sub-language, which needs bindings for implicit forms such as Some relevant documentation pages:
|
|
Btw, I wrote an example comparing Python's PLY and Rhombus' lexer: tokens = (
'PLUS',
'NUMBER',
)
t_PLUS = r'\+'
def t_NUMBER(t):
r'\d+'
t.value = int(t.value)
return t |
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to use the rhombus-parser library, but the examples don't work as presented.
I installed the package using:
The documentation examples make use of a
lexerobject, but it's not immediately obvious how to import it. I think I got it right by doing the following:But then the very first example already fails to run:
The error:
I've tried to solve the problem on my own, but it just doesn't work.
All reactions