Skip to content

GNaive/oops-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oops-parser

Build Status

Oops parser! 🌊

code = '''
($x on $y)
($y left_of $z)
  -{($z color red)
    ($z on $w)
    -{($z color red)
    ($z on $y)}}'''
tokens = tokenize(code)
ast = parse(tokens)
# >> $x.on == $y AND $y.left_of == $z AND NOT ($z.color == red AND $z.on == $w AND NOT ($z.color == red AND $z.on == $y))
print ast
# >> False
print execute_ast(ast, {
    '$x': Var(on=1),
    '$y': Var(left_on=1),
    '$z': Var(color=1, on=1),
    '$w': Var(),
    'red': 1
})

Releases

No releases published

Packages

No packages published

Languages