1 / 25

CONTEXT FREE LANGUAGE

CONTEXT FREE LANGUAGE. Yang telah kita pelajari : Derivation Derivation Order 4-Tuple CFG Bahasa dari Grammar. Yang akan kita pelajari : Pohon Turunan Keambiguan. Pohon Turunan. Pohon Turunan. Pohon Turunan. Diperoleh. Keambiguan. leftmost derivation. leftmost derivation.

dunne
Download Presentation

CONTEXT FREE LANGUAGE

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. CONTEXT FREE LANGUAGE • Yang telahkitapelajari: • Derivation • Derivation Order • 4-Tuple CFG • Bahasadari Grammar • Yang akankitapelajari: • PohonTurunan • Keambiguan

  2. PohonTurunan

  3. PohonTurunan

  4. PohonTurunan Diperoleh

  5. Keambiguan

  6. leftmost derivation

  7. leftmost derivation

  8. Duapohonturunan

  9. Grammar bersifatambigu: string berasaldariduapohonturunan

  10. Grammar bersifatambigu: string berasaldariduapohonturunan

  11. Definisi: Suatucontext-free grammar bersifatambigu Jikasejumlah string berasaldari duaataulebihpohonturunan.

  12. Dengankata lain: Suatucontext-free grammar bersifatambigu Jikasejumlah string memiliki: duaataulebihturunankiri(leftmost derivation). atauturunankanan(rightmost derivation)

  13. Apapentingnyamengetahuikeambiguan? misalkan

  14. Hasil yang benar

  15. Keambiguanituburukuntukbahasapemrograman • Seorangprogrammerharusdapatmenghindarikeamabiguan

  16. Grammar AmbiguLainnya IF_STMT if EXPR then STMT if EXPR then STMT else STMT

  17. If expr1 then if expr2 then stmt1 else stmt2 IF_STMT if expr1 then STMT if expr2 then stmt1 else stmt2 IF_STMT if expr1 then STMT else stmt2 if expr2 then stmt1

  18. Time for Practice!! No.1. Jelaskanmengapa grammar berikutinibersifatambigu. S → 0A | 1B A → 0AA | 1S | 1 B → 1BB | 0S | 0 No.2. Jelaskanmengapa grammar berikutinidisebutambigu. S -> AB | CD A -> 0A1 | 01 B -> 2B | 2 C -> 0C | 0 D -> 1D2 | 12 No.3. Diketahui CFG ambiguberikutini: S → AB | aaB A → a | Aa B → b Tuliskan string s dari grammar tersebut yang memilikiduaturunan paling-kiri (leftmost derivation). Tunjukkanpohonturunannya.

  19. SEE YOU NEXT CLASS

More Related