Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newcomer has a problem with ply.... #4

Closed
akeshmiri opened this issue Jun 30, 2011 · 0 comments
Closed

Newcomer has a problem with ply.... #4

akeshmiri opened this issue Jun 30, 2011 · 0 comments

Comments

@akeshmiri
Copy link

Hi,
Sorry but I could not find any other place to write about my issues.
I am new in Compiler and trying to learn using PLY, it seems very easy and handy, so thank you for you great project. :)
The question is that i cannot made the correct parser for the case when we have something like the following code:

BG = 12 mg/dL
timeout = None

the part which is related to this code in parser is

reserved = {
'bg' : 'BG',
'timeout' : 'TIMEOUT',
}

t_STRING = r'[a-zA-Z]\w_'
t_BG_VALUE = r'\d+\s_mg\s_/\s_dL'
t_TIMEOUT_VALUE = 'None|(30\s_sec)|([1-3]\s_min)'''

def p_configuration_step(t):
'''configuration_step : BG ASSIGN BG_VALUE
| TIMEOUT ASSIGN TIMEOUT_VALUE'''
node = ASTNode(NodeTypes.ConfigurationStep, t[1])
node.insertChild(0, ASTNode(NodeTypes.ConfigurationValue, t[3]))
t[0] = node

what ever I do I got

Syntax error on timeout at line 1

Please advice....

skype: akeshmiri
email: kimiak2000@gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant