1 / 7

Project Part 2: Parser

This project explores the integration of Bison and Flex for generating parsers. It covers command-line options for Bison, key concepts of semantic actions, and how to properly handle unquoted strings and nonterminals in productions. The guide includes steps for compiling with GCC, creating the necessary C files, and incorporating Flex-generated patterns. By following this project, you'll learn to seamlessly generate parsers that efficiently manage translation requirements and handle input to Bison through effective sequence management.

moshe
Télécharger la présentation

Project Part 2: Parser

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Project Part 2: Parser

  2. Project Part 2: Parser Bison Bison Command line: bison –d translate.y Command line: flex filename.l gccy.tab.clex.yy.c -lfl

  3. Input to Bison

  4. Input to Bison

  5. Input to Bison semantic actions (sequence of C statements ) Default semantic action is $$=$1 unquoted strings not declared as tokens are taken as nonterminals $$ attribute value of production head $iattribute value of ith symbol in production body

  6. Input to Bison

  7. bison + flex • First use flex to generate yy.lex.c without mainfunction • In input to bison, put #include “yy.lex.c” in the declaration part of the file Or • Compile both c files with gcc

More Related