Question: PYTHON SLY LIBRARY Im creating my own programming language using the python library Sly lexer and parser. I'm getting an error whenever a decimal is

PYTHON SLY LIBRARY

Im creating my own programming language using the python library Sly lexer and parser. I'm getting an error whenever a decimal is entered in the compiler.

Heres the declaration in my code:

DECIMAL = r'([0-9]*\.[0-9]+|[0-9]+\.?)([Ee][+-]?[0-9]+)?'

@_('DECIMAL') def expr(self,p): return ('decimal', p.DECIMAL)

PYTHON SLY LIBRARY Im creating my own programming language using the python

WARNING: Token(s) {LETTER, DECIMAL_POINT, ANY_STRING} defined, but not used WARNING: There are 3 unused tokens ===LAO Programming Language=== LA0> abc = 1.5 sly: Syntax error at line 1, token=DECIMAL LAO> WARNING: Token(s) {LETTER, DECIMAL_POINT, ANY_STRING} defined, but not used WARNING: There are 3 unused tokens ===LAO Programming Language=== LA0> abc = 1.5 sly: Syntax error at line 1, token=DECIMAL LAO>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!