Exemplo n.º 1
0
/* FIRST(multiplicative arithmetic expression’)={*,/,e}
<multiplicative arithmetic expression’> ->
	* <primary arithmetic expression> <multiplicative arithmetic expression’> 
	| / <primary arithmetic expression> <multiplicative arithmetic expression’> 
	| e
Author: Kyle Hinskens */
void multiplicative_arithmetic_expression_p(void){
	switch(lookahead_token.code){
	case ART_OP_T:
		switch(lookahead_token.attribute.arr_op){
			case MULT:
				match(ART_OP_T,MULT);
				primary_arithmetic_expression();
				multiplicative_arithmetic_expression_p();
				gen_incode("Multiplicative arithmetic expression parsed");
				break;
			case DIV:
				match(ART_OP_T,DIV);
				primary_arithmetic_expression();
				multiplicative_arithmetic_expression_p();
				gen_incode("Multiplicative arithmetic expression parsed");
				break;
		}
	}
}
Exemplo n.º 2
0
/* FIRST(multiplicative arithmetic expression)={AVID_T, FPL_T,INL_T ,(}
<multiplicative arithmetic expression> ->  
	<primary arithmetic expression> <multiplicative arithmetic expression’>
Author: Kwok Hong Kelvin Chan */
void multiplicative_arithmetic_expression(void){
	switch(lookahead_token.code){
		case AVID_T:
		case FPL_T:
		case INL_T:
		case LPR_T: 
			primary_arithmetic_expression(); 
			multiplicative_arithmetic_expression_p(); 
			break;
	}
}
Exemplo n.º 3
0
/*
 * Production: Multiplicative Arithmetic Expression (P)
 * FIRST set: { *, /, e }
 */
void multiplicative_arithmetic_expression_p(void) {
    switch (lookahead.code) {
        case ART_OP_T:
            /* The token attribute mut be DIV or MULT. */
            switch (lookahead.attribute.arr_op) {
                case DIV:
                case MULT:
                    match(ART_OP_T, lookahead.attribute.arr_op);
                    primary_arithmetic_expression();
                    multiplicative_arithmetic_expression_p();
                    gen_incode("PLATY: Multiplicative arithmetic expression parsed");
                    return;
                    
                default:
                    return;
            }
            return;
            
        default:
            return;
    }
}
Exemplo n.º 4
0
/*
 * Production: Multiplicative Arithmetic Expression
 * FIRST set: { AVID_T, FPL_T, INL_T, ( }
 */
void multiplicative_arithmetic_expression(void) {
    primary_arithmetic_expression();
    multiplicative_arithmetic_expression_p();
}