Lec7 - CMPSC 461 Programming Language Concepts Lecture 7...

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

View Full Document Right Arrow Icon
CMPSC 461: Programming Language Concepts Lecture 7 Instructor: Prof. Swarat Chaudhuri
Background image of page 1

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

View Full Document Right Arrow Icon
Grammars Rules to generate sets of (string encodings of) data. (x + 2*(y+5)) (foo 5 6) <html><body>Under construction!</body> <br><br></html> if(x < y) exit(1) else foo(10); Lovely Rita checks the meter.
Background image of page 2
Context-free grammars (x + 2*(y+5)) Not all strings are legitimate expressions. Goal: defining the set of string encodings of legal arithmetic expressions (or, expressions with correct syntax). Recursion. Complex sets broken down into simpler ones. Nonterminal symbols: symbols standing for such sets. Can be broken down further. Productions: rules for breaking down. Terminal symbols: x , 2 , foo , “Rita” ,…. Correspond to base case.
Background image of page 3

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

View Full Document Right Arrow Icon
Example: boolean expressions Bexp Bexp Bexp Bexp Bexp || Bexp Bexp ! Bexp Bexp true Bexp false Bexp ( Bexp ) Starting nonterminal: Bexp
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 16

Lec7 - CMPSC 461 Programming Language Concepts Lecture 7...

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

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