Ejemplo n.º 1
0
def p_frac(p):
    '''frac : FRAC command block
                | FRAC block command
                | FRAC block block'''
    p[0] = formulate.formulate(
        'comienza fracción', OPTION) + p[2] + formulate.formulate(
            'sobre', OPTION) + p[3] + formulate.formulate(
                'fin fracción', OPTION)
Ejemplo n.º 2
0
def p_choose(p):
    '''choose : command CHOOSE command
                | command CHOOSE block
                | block CHOOSE command
                | block CHOOSE block'''
    p[0] = formulate.formulate('combinaciones de',
                               OPTION) + p[1] + formulate.formulate(
                                   'en', OPTION) + p[3]
Ejemplo n.º 3
0
def p_binom(p):
    '''binom : BINOM command command
            | BINOM command block
            | BINOM block command
            | BINOM block block '''
    p[0] = formulate.formulate('combinaciones de',
                               OPTION) + p[2] + formulate.formulate(
                                   'en', OPTION) + p[3]
Ejemplo n.º 4
0
def p_complexAccent(p):
    '''accent : ACCENT block'''
    if (len(p[2]) > 3):
        p[0] = formulate.formulate(dAccents.showReading(p[1]),
                                   OPTION) + p[2] + formulate.formulate(
                                       'fin ' + dAccents.showReading(p[1]),
                                       OPTION,
                                   )
    else:
        p[0] = p[2] + formulate.formulate(dAccents.showReading(p[1]), OPTION)
Ejemplo n.º 5
0
def p_largeOp(p):
    '''larop : LARGEOP
                | LARGEOP SUB command
                | LARGEOP SUB block'''
    if (len(p) == 2):
        p[0] = formulate.formulate(dLargeOperators.showReading(p[1]), OPTION)
    elif (len(p) == 4):
        p[0] = formulate.formulate(
            dLargeOperators.showReading(p[1]) + ' sobre',
            OPTION) + p[3] + formulate.formulate('de', OPTION)
Ejemplo n.º 6
0
def p_lim(p):
    '''lim : LIM
            | LIM SUB command
            | LIM SUB block '''
    if (len(p) == 4):
        p[0] = formulate.formulate('límite cuando',
                                   OPTION) + p[3] + formulate.formulate(
                                       'de', OPTION)
    else:
        p[0] = formulate.formulate('límite de', OPTION)
Ejemplo n.º 7
0
def p_compScripted(p):
    '''scripted : command SUP command SUB command
                    | command SUP command SUB block
                    | command SUP block SUB command
                    | command SUP block SUB block
                    | block SUP command SUB command
                    | block SUP command SUB block
                    | block SUP block SUB command
                    | block SUP block SUB block
                    | command SUB command SUP command
                    | command SUB command SUP block
                    | command SUB block SUP command
                    | command SUB block SUP block
                    | block SUB command SUP command
                    | block SUB command SUP block
                    | block SUB block SUP command
                    | block SUB block SUP block'''
    if (p[2] == '^'):
        p[0] = p[1] + formulate.formulate(
            'súper', OPTION) + p[3] + formulate.formulate(
                'fin súper', OPTION) + formulate.formulate(
                    'sub', OPTION) + p[5] + formulate.formulate(
                        'fin sub', OPTION)
    else:
        p[0] = p[1] + formulate.formulate(
            'sub', OPTION) + p[3] + formulate.formulate(
                'fin sub', OPTION) + formulate.formulate(
                    'súper', OPTION) + p[5] + formulate.formulate(
                        'fin súper', OPTION)
Ejemplo n.º 8
0
def p_root(p):
    '''root : ROOT command
            | ROOT block
            | ROOT KDELIMITER content KDELIMITER command
            | ROOT KDELIMITER content KDELIMITER block '''
    if (len(p) == 3):
        p[0] = formulate.formulate('raíz cuadrada de',
                                   OPTION) + p[2] + formulate.formulate(
                                       'termina raíz', OPTION)
    else:
        p[0] = formulate.formulate(
            'raíz', OPTION) + p[3] + formulate.formulate(
                'de', OPTION) + p[5] + formulate.formulate(
                    'termina raíz', OPTION)
Ejemplo n.º 9
0
def p_comLargeOp(p):
    '''larop : LARGEOP SUB command SUP command
                | LARGEOP SUB command SUP block
                | LARGEOP SUB block SUP command
                | LARGEOP SUB block SUP block
                | LARGEOP SUP command SUB command
                | LARGEOP SUP command SUB block
                | LARGEOP SUP block SUB command
                | LARGEOP SUP block SUB block'''
    if (p[2] == '_'):
        p[0] = formulate.formulate(
            dLargeOperators.showReading(p[1]) + ' desde',
            OPTION) + p[3] + formulate.formulate(
                'hasta', OPTION) + p[5] + formulate.formulate('de', OPTION)
    else:
        p[0] = formulate.formulate(
            dLargeOperators.showReading(p[1]) + ' desde',
            OPTION) + p[5] + formulate.formulate(
                'hasta', OPTION) + p[3] + formulate.formulate('de', OPTION)
Ejemplo n.º 10
0
def p_prime(p):
    '''prime : "'" '''
    p[0] = formulate.formulate('prima', OPTION)
Ejemplo n.º 11
0
def p_factorial(p):
    '''factorial : '!' '''
    p[0] = formulate.formulate('factorial', OPTION)
Ejemplo n.º 12
0
def p_array(p):
    '''array : BEGARRAY arrayContent ENDARRAY '''
    p[0] = formulate.formulate('Arreglo\n',
                               OPTION) + p[2] + formulate.formulate(
                                   'Fin Arreglo\n', OPTION)
Ejemplo n.º 13
0
def p_userCommand(p):
    '''user : USER'''
    p[0] = formulate.formulate(dUser.showReading(p[1]), OPTION)
Ejemplo n.º 14
0
def p_unknown(p):
    '''unknown : UNKNOWN'''
    p[0] = formulate.formulate(p[1], OPTION)
Ejemplo n.º 15
0
def p_binRel(p):
    '''binrel : BINREL
                | KBINREL'''
    p[0] = formulate.formulate(dBinaryRelations.showReading(p[1]), OPTION)
Ejemplo n.º 16
0
def p_style(p):
    '''style : STYLE command
                | STYLE block '''
    p[0] = formulate.formulate(dStyles.showReading(p[1]),
                               OPTION) + p[2] + formulate.formulate(
                                   'fin ' + dStyles.showReading(p[1]), OPTION)
Ejemplo n.º 17
0
def p_linebreak(p):
    '''lnbrk : LINEBREAK'''
    p[0] = formulate.formulate('salto de línea', OPTION)
Ejemplo n.º 18
0
def p_binOp(p):
    '''binop : BINOP
                | KBINOP '''
    p[0] = formulate.formulate(dBinaryOperators.showReading(p[1]), OPTION)
Ejemplo n.º 19
0
def p_pmod(p):
    '''pmod : PMOD command'''
    p[0] = formulate.formulate('módulo', OPTION) + p[2]
Ejemplo n.º 20
0
def p_arrow(p):
    '''arrow : ARROW'''
    p[0] = formulate.formulate(dArrows.showReading(p[1]), OPTION)
Ejemplo n.º 21
0
def p_not(p):
    '''not : NOT '''
    p[0] = formulate.formulate('no', OPTION)
Ejemplo n.º 22
0
def p_simpleFrac(p):
    '''frac : FRAC command command '''
    p[0] = p[2] + formulate.formulate('sobre', OPTION) + p[3]
Ejemplo n.º 23
0
def p_dots(p):
    '''dots : DOTS '''
    p[0] = formulate.formulate(dDots.showReading(p[1]), OPTION)
Ejemplo n.º 24
0
def p_delimiter(p):
    '''delimiter : DELIMITER
                    | KDELIMITER '''
    p[0] = formulate.formulate(dDelimiters.showReading(p[1]), OPTION)
Ejemplo n.º 25
0
def p_function(p):
    '''function : FUNC '''
    p[0] = formulate.formulate(dMathFunctions.showReading(p[1]), OPTION)
Ejemplo n.º 26
0
def p_blockpmod(p):
    '''pmod : PMOD block'''
    p[0] = formulate.formulate('módulo',
                               OPTION) + p[2] + formulate.formulate(
                                   'fin mod', OPTION)
Ejemplo n.º 27
0
def p_simpleAccent(p):
    '''accent : ACCENT command'''
    p[0] = p[2] + formulate.formulate(dAccents.showReading(p[1]), OPTION)
Ejemplo n.º 28
0
def p_textBlock(p):
    '''textBlock : TEXT any '''
    p[0] = formulate.formulate('comienza texto ',
                               OPTION) + p[2] + formulate.formulate(
                                   ' termina texto', OPTION)
Ejemplo n.º 29
0
def p_ord(p):
    '''ord : ORD '''
    p[0] = formulate.formulate(
        dOrdinary.showReading(p[1]), OPTION
    )  #--->Los operadores son la llave y el valor por defecto que esté en la lectura