19.04.2013 Views

Parte 3 - Unicamp

Parte 3 - Unicamp

Parte 3 - Unicamp

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Especificação para o CUP (2)<br />

• Definição dos símbolos terminais e não terminais:<br />

/* Terminals (tokens returned by the scanner). */<br />

terminal SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD;<br />

terminal UMINUS, LPAREN, RPAREN;<br />

terminal Integer NUMBER;<br />

/* Non terminals */<br />

non terminal expr_list, expr_part;<br />

non terminal Integer expr, term, factor;<br />

Neste exemplo, os terminais não tem tipo. É possível associar<br />

tipos (classes) aos símbolos.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!