# Perisian Sistem : Modul 1

## Presentation on theme: "Perisian Sistem : Modul 1"— Presentation transcript:

Perisian Sistem : Modul 1
Pengkompil : pepohon huraian Pepohon huraian digunakan untuk menghuraikan fasa-fasa pengkompil keatas satu pernyataan. Contoh simulasi :- Simulasi 1 Simulasi 2 Simulasi 3

( A*B)-((D+E)+(F DIV G))
Simulasi 1 ( A*B)-((D+E)+(F DIV G)) Start Main Menu

Simulaisi 1 Main menu <exp> <exp> - <term> (
) ( <term> ) <term> <factor> <exp> <term> <factor> Id {B} ( <exp> ) <term> DIV <factor> <exp> Id {A} <term> <factor> Id {G} <factor> <factor> Id {F} Id {D} Id {E} Main menu

Simulasi 2 Program Kira; VAR Markah : INTEGER; Jumlah , X : INTEGER
BEGIN X := 0; FOR X := 0 TO 3 DO Jumlah := (jumlah div 2) + Markah END. Main Menu Start

Main menu Simulasi 2 <prog> PROGRAM VAR BEGIN END
<prog-name> <dec-list> <stmt-list> <dec-list> ; <dec> <stmt-list> ; <stmt> <factor> <id-list> : <type> <stmt> <for> id {kira} <dec> FOR DO INTEGER <assign> <index-exp> <body> <id-list> <type> <assign> id {x} := <exp> <id> {markah} INTEGER id {jumlah} :- <exp> <term> <factor> <id-list> , <id> {x} int {0} <exp> + <term> <id> {jumlah} ( <term> ) <factor> id {x} := <exp> <term> DIV <factor> id {markah} <term> <factor> int {2} <factor> id {jumlah} int {0} Main menu

Simulasi 3 Program Contoh; Var L,M : INTEGER BEGIN FOR L := 1 TO 5 DO
FOR M := 1 TO L DO READ(cuba) END Main Menu Start

Simulasi 3 Main menu <prog> PROGRAM <prog-name> VAR
<dec-list> BEGIN <stmt-list> END Id <dec> <stmt> {Contoh} <for> <id-list> <type> INTEGER <body> <id-list> Id {M} <for> FOR <index-exp> DO id <exp> TO <exp> FOR <index-exp> DO <body> {L} <stmt> <term> <term> id <exp> TO <exp> {M} <read> <factor> <factor> <term> <term> READ ( <id-list> ) int int <factor> <factor> {L} {5} id int int {Cuba} {1} {L} Main menu

Similar presentations