Cart (Loading....) | Create Account
Close category search window
 

Compiler Construction Using Java, JavaCC, and Yacc

Cover Image Copyright Year: 2012
Author(s): Dos Reis, A.
Publisher: Wiley-IEEE Press
Content Type : Books & eBooks
Topics: Communication, Networking & Broadcasting ;  Components, Circuits, Devices & Systems ;  Computing & Processing (Hardware/Software)
  • Print

Abstract

A student-friendly, course-friendly guide to compiler theory, applications, and programming technologyCompiler construction is a tricky subject, involving theory, the application of that theory, and programming technology. Virtually every day, advances in computer technology propel advances in compiler technology. Compiler Construction Using Java, JavaCC, and Yacc covers every topic essential to learning compilers from the ground up and is accompanied by a powerful and flexible software package for evaluating projects as well as several tutorials, well-defined projects, and test cases. While the coverage of JavaCC is entirely optional, this book provides the only comprehensive introduction to the topic currentlyavailable.Far easier to read and understand than any other compiler guide, this booksets a new standard for learning this invaluable skill. It provides:
Strong coverage of formal languages, including context-sensitive and unrestricted languages as well as regular and context-free languages
A clear exposition of compiler design and implementation theory
Numerous well-defined projects, using source language with six levels of complexity
A complete teaching support software package that evaluates compiler projects for correctness, run time, and size of code, and runs on multiple platforms
Immediate feedback for students on their projectsCompiler Construction Using JavaTM, JavaCC, and Yacc provides substantial support for each project, many of which are incremental enhancements of previous projects. The goals at each new level are challenging but achievable and can be reached in several different ways, for example, by writing a compiler or interpreter by hand, with JavaCC, or with Yacc.

  •   Click to expandTable of Contents

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Front Matter

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.fmatter
      Page(s): i - xvii
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      The prelims comprise:
      Half Title
      Board Members
      Title
      Copyright
      Dedication
      Contents
      Preface View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Strings, Languages, and Compilers

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch1
      Page(s): 1 - 17
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Basic Language Concepts
      Basic Compiler Concepts
      Basic Set Theory
      Null String
      Concatenation
      Exponent Notation
      Star Operator (Also Known as the Zero-or-More Operator)
      Concatenation of Sets of Strings
      Plus Operator (Also Known as the One-or-More Operator)
      Question Mark Operator (Also Known as Zero-or-One Operator)
      Shorthand Notation for a Set Containing a Single String
      Operator Precedence
      Regular Expressions
      Limitations of Regular Expressions
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Context-Free Grammars, Part 1

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch2
      Page(s): 19 - 47
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      What is a Context-Free Grammar?
      Derivations Using a Context-Free Grammar
      Language Defined By a Context-Free Grammar
      Different Ways of Representing Context-Free Grammars
      Some Simple Grammars
      Techniques for Generating Languages with Context-Free Grammars
      Regular and Right Linear Grammars
      Counting with Regular Grammars
      Grammars for Lists
      An Important Language That is not Context-Free
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Context-free Grammars, Part 2

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch3
      Page(s): 49 - 81
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Parse Trees
      Leftmost and Rightmost Derivations
      Substitution
      Ambiguous Grammars
      Determining Nullable Nonterminals
      Eliminating Lambda Productions
      Eliminating Unit Productions
      Eliminating Useless Nonterminals
      Recursion Conversions
      Adding The Null string to a language
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Context-Free Grammars, Part 3

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch4
      Page(s): 83 - 106
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Grammars for Arithmetic Expressions
      Specifying Associativity and Precedence in Grammars
      Backus-Naur Form
      Syntax Diagrams
      Abstract Syntax Trees and Three-Address Code
      Noncontracting Grammars
      Essentially Noncontracting Grammars
      Converting a Context-Free Grammar to an Essentially Noncontracting Grammar
      Pumping Property of Context-Free Languages (Optional)
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Chomsky's Hierarchy (Optional)

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch5
      Page(s): 107 - 113
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Context-Sensitive Productions
      Context-Sensitive Grammars
      Unrestricted Grammars
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Top-Down Parsing

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch6
      Page(s): 115 - 135
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Top-Down Construction of a Parse Tree
      Parses That Fail
      A Bad Grammar for Top-Down Parsing
      Deterministic Parsers
      A Parser That Uses a Stack
      Table Representation of a Stack Parser
      Handling Productions with Nonleading Terminals
      Writing a Stack Parser in Java
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      LL(1) Grammars

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch7
      Page(s): 137 - 169
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      First Set of the Right Side of a Production
      Determining Operation Sequences
      Determining Selection Sets of Lambda Productions
      Whatever-Follows-Left-Follows-Rightmost Rule
      Selection Sets for Productions with Nullable Right Sides
      Selection Sets Containing the End-of-Input Marker
      A Stack Parser for a Grammar with Lambda Productions
      Converting a Non-LL(1) Grammar to an LL(1) Grammar
      Parsing with an Ambiguous Grammar
      Computing First and Follow Sets
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Table-Driven Stack Parser (Optional)

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch8
      Page(s): 171 - 184
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Unifying the Operations of a Stack Parser
      Implementing a Table-Driven Stack Parser
      Improving our Table-Driven Stack Parser
      Parsers that are not Deterministic - A Digression on Theory (Optional)
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Recursive-Descent Parsing

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch9
      Page(s): 185 - 214
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      A Simple Recursive-Descent Parser
      Handling Lambda Productions
      A Common Error
      Java Code for Productions
      Left Factoring in a Recursive-Descent Parser
      Eliminating Tail Recursion
      Translating the Star, Plus, and Question Mark Operators
      Doing Things Backward
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Recursive-Descent Translation

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch10
      Page(s): 215 - 263
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      A Simple Translation Grammar
      Converting a Translation Grammar to Java Code
      Specifications for a Translation Grammar
      Passing Information During the Parse
      L-Attributed Grammars
      A New Token Manager
      Solving the Token Lookahead Problem
      Code for the New Token Manager
      Translation Grammar for Prefix Expression Compiler
      An Interesting Use of Recursion (Optional)
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Assembly Language

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch11
      Page(s): 265 - 287
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Structure of the J1 Computer
      Machine Language Instructions
      Assembly Language Instructions
      Pushing Characters
      aout Instruction
      Using Labels
      Using the Assembler
      stav Instruction
      Compiling an Assignment Statement
      Compiling print and println
      Outputting Strings
      Inputting Decimal Numbers
      Entry Directive
      More Assembly Language
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      S1 - A Simple Compiler

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch12
      Page(s): 289 - 329
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      The Source Language
      Grammar for Source Language
      The Target Language
      Symbol Table
      Code Generator
      token Class
      Writing The Translation Grammar
      Implementing the S1 Compiler
      Trying Out S1
      Advice on Extending the S1 Compiler
      Specifications For S2
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      JavaCC (Optional)

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch13
      Page(s): 331 - 381
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      JavaCC Extended Regular Expressions
      JavaCC Input File
      Specifying Actions for Regular Expressions
      JavaCC Input File for S1j
      Files Produced by JavaCC
      Using the Star and PLUS Operators
      Choice Points and Lookahead
      JavaCC'S Choice Algorithm
      Syntactic and Semantic Lookahead (Optional)
      Using JavaCC to Create a Token Manager Only
      Using the Token Chain
      Suppressing Warning Messages
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Building on S2

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch14
      Page(s): 383 - 398
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Extending println and print
      Cascaded Assignment Statement
      Unary Plus and Minus
      readint Statement
      Controlling the Token Trace from the Command Line
      Specifications for S3
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Compiling Control Structures

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch15
      Page(s): 399 - 434
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      while Statement
      if Statement
      do-while Statement
      Range Checking of Numerical Constants
      Handling Backslash-Quote in a String
      Handling Backslash-Quote with JavaCC (Optional)
      Univeral Blocks in JavaCC (Optional)
      Handling Strings that Span Lines
      Handling Strings that Span Lines using JavaCC (Optional)
      SPECIAL_TOKEN Block in JavaCC (Optional)
      Error Recovery
      Error Recovery in JavaCC (Optional)
      Specifications for S4
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Compiling Programs in Functional Form

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch16
      Page(s): 435 - 463
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Separate Assembly and Linking
      Calling and Returning from Functions
      Source Language for S5
      Symbol Table for S5
      Code Generator for S5
      Translation Grammar for S5
      Linking with a Library
      Specifications for S5
      Extending S5 (Optional)
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Finite Automata

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch17
      Page(s): 465 - 497
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Deterministic Finite Automata
      Converting a DFA to a Regular Expression
      Java Code for a DFA
      Nondeterministic Finite Automata
      Using an NFA as an Algorithm
      Converting an NFA to a DFA with the Subset Algorithm
      Converting a DFA to a Regular Grammar
      Converting a Regular Grammar to an NFA
      Converting a Regular Expression to an NFA
      Finding the Minimal DFA
      Pumping Property of Regular Languages
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Capstone Project: Implementing Grep Using Compiler Technology

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch18
      Page(s): 499 - 514
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Regular Expressions for our Grep Program
      Token Manager for Regular Expressions
      Grammar for Regular Expressions
      Target Language for our Regular Expression Compiler
      Using an NFA for Pattern Matching
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Compiling to a Register-Oriented Architecture

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch19
      Page(s): 515 - 527
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Using the Register Instruction Set
      Modifications to the Symbol Table for R1
      Parser and Code Generator for R1
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Optimization

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch20
      Page(s): 529 - 546
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Using The ldc Instruction
      Reusing Temporary Variables
      Constant Folding
      Register Allocation
      Peephole Optimization
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Interpreters

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch21
      Page(s): 547 - 560
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Converting S1 to I1
      Interpreting Statements that Transfer Control
      Implementing the Compiler-Interpreter CI1
      Advantages of Interpreters
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Bottom-up Parsing

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch22
      Page(s): 561 - 585
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      Principles of Bottom-up parsing
      Parsing with right- versus left-recursive Grammars
      Bottom-up parsing with Ambiguous Grammars
      Do-not-reduce Rule
      SLR(1) Parsing
      Shift/Reduce Conflicts
      Reduce/Reduce Conflicts
      LR(1) Parsing
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Yacc

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.ch23
      Page(s): 587 - 619
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      This chapter contains sections titled:
      Introduction
      yacc Input and Output Files
      A Simple yacc-Generated Parser
      Passing Values using the Value Stack
      Using yacc with an Ambiguous Grammar
      Passing Values Down the Parse Tree
      Implementing Sly
      jflex
      Problems View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Appendix A: Stack Instruction Set

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.app1
      Page(s): 621 - 624
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      No Abstract. View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Appendix B: Register Instruction Set

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.app2
      Page(s): 625 - 628
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      No Abstract. View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      References

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.refs
      Page(s): 629
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      No Abstract. View full abstract»

    • Full text access may be available. Click article title to sign in or learn about subscription options.

      Index

      Dos Reis, A.
      Compiler Construction Using Java, JavaCC, and Yacc

      DOI: 10.1002/9781118112762.index
      Page(s): 631 - 635
      Copyright Year: 2012

      Wiley-IEEE Press eBook Chapters

      No Abstract. View full abstract»




| Create Account

IEEE Account

Purchase Details

Profile Information

Need Help?


IEEE Advancing Technology for Humanity About IEEE Xplore | Contact | Help | Terms of Use | Nondiscrimination Policy | Site Map | Privacy & Opting Out of Cookies

A not-for-profit organization, IEEE is the world's largest professional association for the advancement of technology.
© Copyright 2014 IEEE - All rights reserved. Use of this web site signifies your agreement to the terms and conditions.