1 / 7

Plan for Lecture

This lecture preparation guide covers reviewing, fixing code, adding style, understanding grammars, Backus-Naur Form (BNF), and sentence generation. Learn about syntax, terminals, non-terminals, and more to enhance programming skills.

cnorris
Download Presentation

Plan for Lecture

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. Plan for Lecture • Review code and trace output • Fix style and add indentation to output • Grammars and Regular Expressions • Exam Materials

  2. print file = cats subFiles = [cats-and-dogs, recursion, cat3.jpg, …] i = 0 file = cats subFiles = [cats-and-dogs, recursion, cat3.jpg, …] i = 0 1 file = recursion … file = cats-and-dgs subFiles = [picture1.jpg, picture2.jpg] i = 0 file = cats-and-dgs subFiles = [picture1.jpg, picture2.jpg] i = 0 1 cats cats-and-dogs picture1.jpg picture2.jpg recursion … file = picture2.jpg file = picture1.jpg

  3. Languages and grammars • (formal) language: A set of words or symbols. • grammar: A description of a language that describes which sequences of symbols are allowed in that language. • describes language syntax (rules) but not semantics (meaning) • can be used to generate strings from a language, or to determine whether a given string belongs to a given language

  4. Backus-Naur (BNF) • Backus-Naur Form (BNF): A syntax for describing language grammars in terms of transformation rules, of the form: <symbol> ::= <expression> | <expression> ...| <expression> • terminal: A fundamental symbol of the language. • non-terminal: A high-level symbol describing language syntax, which can be transformed into other non-terminal or terminal symbol(s) based on the rules of the grammar. • developed by two Turing-award-winning computer scientists in 1960 to describe their new ALGOL programming language

  5. <s> <np> <vp> <tv> <np> <pn> <dp> <adjp> <n> <adj> <adjp> <adj> Fred honored the green wonderful child Sentence generation

More Related