Project2 - CSE 450 Project 2, Spring 2008 Objectives: Gain...

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

View Full Document Right Arrow Icon
CSE 450 Project 2, Spring 2008 Objectives: Gain experience developing a context free grammar for a block-structured programming lan- guage. Gain familiarity with the bison parser generator. Description: As described in the first project, your term project involves the construction of a compiler for a language called SpartanAda , which is a subset of the Ada95 programming language. For this, the second project, you will construct a parser for that subset of SpartanAda that includes variable declarations, procedure calls, arithmetic and logical expressions, assignment statements, conditional and looping statements. Your program must read in the source file (whose name is supplied as a command line argument) and parse it. If the parse is successful, your program should return 0. If the input contains syntax errors, your program should output a meaningful error message, detailing the line number upon which the error was detected, and should abort, returning 1. Make sure you understand the language well before you start, and remember that the program you write now will be used as the basis for future projects so you want to make it easily extensible. I recommend you begin this project by developing a context free grammar for the subset of SpartanAda described below. In reading this description, please note the symbol stmt refers to a SpartanAda statement, var refers to a variable declared in some statement block, expr refers to an expression that may be evaluated, and range refers to a range of scalar values 1 Also, when describing the syntax of a given statement, I will use square brackets (rather than parentheses) for grouping and
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Project2 - CSE 450 Project 2, Spring 2008 Objectives: Gain...

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

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