Error
  • JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING
  • JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING
Spread Knowledge

Virtual University of Pakistan Video Lectures, Handouts, PPT, Quizzes, Assignments & Papers

CS606 - Compiler Construction - Lecture Handout 34

User Rating:  / 0

Related Content: CS606 - VU Lectures, Handouts, PPT Slides, Assignments, Quizzes, Papers & Books of Compiler Construction

Let’s go through an example of using YACC to implement the ad-hoc scheme for an arithmetic calculator.

The YACC file for a calculator grammar is as follows:

%token NUMBER LPAREN RPAREN
%token PLUS MINUS TIMES DIVIDE
%%

Read more: CS606 - Compiler Construction - Lecture Handout 34

CS606 - Compiler Construction - Lecture Handout 33

User Rating:  / 0

Related Content: CS606 - VU Lectures, Handouts, PPT Slides, Assignments, Quizzes, Papers & Books of Compiler Construction

Implementing Ad-Hoc Scheme

The parser needs a mechanism to pass values of attributes from definitions in one snippet to uses in another. We will adopt notation used by YACC for snippets and passing values. Recall that the skeleton LR(1) parser stored two values on the stack 〈symbol,state〉.

Read more: CS606 - Compiler Construction - Lecture Handout 33