(p)
field_req : REQUIRED
                 | OPTIONAL
                 |
field_req : REQUIRED
                 | OPTIONAL
                 |
field_req : REQUIRED | OPTIONAL |
def p_field_req(p):
    '''field_req : REQUIRED
                 | OPTIONAL
                 |'''
    if len(p) == 2:
        p[0] = p[1] == 'required'
    elif len(p) == 1:
        p[0] = False
def p_field_req ( p ) : if len ( p ) == 2 : p [ 0 ] = p [ 1 ] == 'required' elif len ( p ) == 1 : p [ 0 ] = False