1 / 16

High-level Languages

High-level Languages. Grammars Parsers Constructs Compilers. Advantages. More powerful Enforce structure easier to read fewer bugs Portable. Grammars. Definition: A system of rules that defines the structure of a language

landen
Download Presentation

High-level Languages

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. High-level Languages • Grammars • Parsers • Constructs • Compilers

  2. Advantages • More powerful • Enforce structure • easier to read • fewer bugs • Portable

  3. Grammars Definition: A system of rules that defines the structure of a language Identification of which rules were used in a sentence allows us to interpret its meaning

  4. Examples • You are welcome. • You should welcome the guests. • I am blue. • The wall is blue.

  5. Examples II • Cool… • Turn left at the light.

  6. Parsers • Parsing • The act of resolving a sentence into its component pieces according to the rules of a specific grammar A parser matches words to predicates to determine which rules were used

  7. Figure 18.11 A parsed English language sentence

  8. Concepts to Code Branching LDA x BRP y BRA z y … BRA *** z … *** … x > 0? y z

  9. Constructs • Do one of two things based on a condition • Do the first thing or the second thing based on a condition • Do the first thing based on a condition, otherwise do the second thing • If a condition is true, then do the first thing. Otherwise, do the second thing if (condition) then {first thing} else {second thing}

  10. Conversion Examples Explain the following to a computer: • A passed student is allowed to continue • Don’t drink and drive

  11. Diagram of Construct

  12. Figure 18.15 Successive stages of parsing

  13. Figure 18.15 (continued)

  14. Compilers Translate high-level language programs into Assembly • Identify constructs • Translate into specified Assembly • No interpretation!!

  15. Similarities… • First flowchart has “large” boxes • Boxes expand into more flowcharts • Compiler checks that each level is correct

  16. Summary • Must use restricted syntax to express ideas • Must be explicit with description of ideas

More Related