Ejemplo n.º 1
0
                  | property OR property
                  | property IMPLIES property
                  | property EQUIV property

                  | property TEMPORAL_BINARY property"""
    assert p[2] in BIN_OPS
    p[0] = BinOp(p[2], p[1], p[3])


def p_section_data_property_unary(p):
    """property   : TEMPORAL_UNARY property
                  | NEG property """
    p[0] = UnaryOp(p[1], p[2])


def p_section_data_property_grouping(p):
    """property   : LPAREN property RPAREN"""
    p[0] = p[2]


def p_error(p):
    if p:
        print("----> Syntax error at '%s'" % p.value)
    else:
        print('----> Syntax error, t is None')
    assert 0


from third_party.ply import yacc
anzu_parser = yacc.yacc(debug=0, outputdir=os.path.dirname(os.path.realpath(__file__)))
Ejemplo n.º 2
0
    t[0] = t[1]


def p_expression_name(t):
    'expression : NAME'
    try:
        t[0] = names[t[1]]
    except LookupError:
        print("Undefined name '%s'" % t[1])
        t[0] = 0


def p_expression_ogo(p):
    '''expression : PI'''
    p[0] = 314


def p_error(t):
    print("Syntax error at '%s'" % t.value)


import third_party.ply.yacc as yacc

yacc.yacc()

while 1:
    try:
        s = input('calc > ')  # Use raw_input on Python 2
    except EOFError:
        break
    yacc.parse(s)
Ejemplo n.º 3
0
Archivo: calc.py Proyecto: 5nizza/Party
    'expression : LPAREN expression RPAREN'
    t[0] = t[2]

def p_expression_number(t):
    'expression : NUMBER'
    t[0] = t[1]

def p_expression_name(t):
    'expression : NAME'
    try:
        t[0] = names[t[1]]
    except LookupError:
        print("Undefined name '%s'" % t[1])
        t[0] = 0

def p_expression_ogo(p):
    '''expression : PI'''
    p[0] = 314

def p_error(t):
    print("Syntax error at '%s'" % t.value)

import third_party.ply.yacc as yacc
yacc.yacc()

while 1:
    try:
        s = input('calc > ')   # Use raw_input on Python 2
    except EOFError:
        break
    yacc.parse(s)
Ejemplo n.º 4
0
                  | property EQUIV property

                  | property TEMPORAL_BINARY property"""
    assert p[2] in BIN_OPS
    p[0] = BinOp(p[2], p[1], p[3])


def p_unit_data_property_unary(p):
    """property   : TEMPORAL_UNARY property
                  | NEG property """
    p[0] = UnaryOp(p[1], p[2])


def p_unit_data_property_grouping(p):
    """property   : LPAREN property RPAREN"""
    p[0] = p[2]


def p_error(p):
    if p:
        print("----> Syntax error at '%s'" % p.value)
        print("lineno: %d" % p.lineno)
    else:
        print('----> Syntax error, t is None')
    assert 0


from third_party.ply import yacc
acacia_parser = yacc.yacc(debug=0,
                          outputdir=os.path.dirname(
                              os.path.realpath(__file__)))