{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Termnonterm strings f n a or a if a in

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: spot –  Powerful enough to describe nGrossman Dan esQng, recursion Dan Grossmansome more general grammars –  But easy to parse, unlike Fall 2011 •  Not perfect Fall 2011 –  Cannot capture semanQcs, as in “variable must be declared” –  Can be ambiguous – i.e., mulQple ways to derive a string, which may lead to different “meanings” (e.g., order of operaQon) Winter 2013 UW CSE 401 (Michael Ringenburg) 32 Context- Free Grammars CSE341: Programming Languages CSE341: grammar G is Languages •  Formally, a Programming a tuple <N,Σ,P,S> where Lecture 1 L ymbols –  N a finite set of non- terminal secture 1 C ymbols C et of t Mechanics –  Σ a finite sourseerminal sourse Mechanics ML Variable Bindings ML Variable Bindings –  P a finite set of producQons •  A subset of N × (N ∪ Σ )*, i.e., a non- terminal right- Dan Grossman Dan Grossman hand side, and zero or more terminals and non- Fall 2011 Fall 2011 terminals on the leg- hand side. –  S the start symbol, a disQnguished element of N •  If not specified otherwise, this is usually assumed to be the non- terminal on the leg of the first producQon Winter 2013 UW CSE 401 (Michael Ringenburg) 33 Standard NotaQons CSE341: Programming CSE341: Programming Languages Languages •  •  •  •  •  •  a, b, c elements of Σ (terminals) 1 Lecture 1 Lecture Course Mechanics w, x, y, z Course Mechanics elements of Σ* (terminal strings) ML Variable Bindings ML Variable Bindings A, B, C elements of N (nonterminals) an Grossman Dan of N ( X, Y, Z elements GrossmanΣ Dterminals or nonterms) ∪ Fall 2011 Fall α, β, γ elements o2011 ∪ Σ )* (term/nonterm strings) f (N A α or A ::= α if <A, α> in P (producQons) Winter 2013 UW CSE 401 (Michael Ringenburg) 34 DerivaQon RelaQons (1) CSE341: Programming CSE341: Programming Languages Languages •  α A γ => α β γ iff A ::= β in P Lecture 1 Lecture 1 Course Course Mechanics Mechanics ML Variable ro...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern