dis4 - CMPSC 160 Translation of Programming Languages...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPSC 160 Translation of Programming Languages Project 2 cont‟d
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Agenda Project 1 Summary Review of Project 2 Lex and Yacc: Runing Example Manual Problems Associativity and Precedence in Yacc
Background image of page 2
Project 1 summary Test case 10 kinds of errors One large correct test case Large number, Line no error / missing Your Grades Finished last Fri / Deliver on Thu Avg Score: very high Bonus Credit
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Project 2 Review Regular Expression State Machine yylex() CSimple File Token Grammar Rule LALR yyparse() main() Analysis Output
Background image of page 4
A Running Example %{ #include <stdio.h> #include "global.h" %} digit [0-9] %% \+ {return PLUS;} \- {return MINUS;} {digit} {return DIGIT} [ \t\n] {} <<EOF>> {return EOF} %% int yywrap() { return 1; } %{ #include <stdio.h> %} %token DIGIT EOF %left PLUS %% root : expr EOF; expr : expr PLUS expr | expr MINUS expr | DIGIT ; %% extern int yylineno; void yyerror(const char *s) { fprintf(stderr, "%s at line %d\n", s, yylineno); return; }
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A Running Example \+ {return PLUS;} \- {return MINUS;} {digit} {return DIGIT} [ \t\n] {} <<EOF>> {return EOF} root : expr EOF; expr : expr PLUS expr | expr MINUS expr
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/23/2010 for the course MATH 104b taught by Professor Ceniceros,h during the Spring '08 term at UCSB.

Page1 / 17

dis4 - CMPSC 160 Translation of Programming Languages...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online