Listing Program
program Scan;
Uses crt;
Var
   x : text;
   y : Char;
   token,Ttoken : String;
procedure input;
begin
     read(x,y);
end;
procedure output;
begin
     writeln(token:10,' ',Ttoken);
end;
procedure scan;
begin
clrscr;
     assign(x,'contoh.txt');
     reset(x);
     repeat
           input;
           if (y in['A'..'Z','a'..'z']) then
              begin
                 repeat
                    begin
                         token := token + y;
                         input;
                    end;
                 until (not(y in['A'..'Z','a'..'z']));
                       Ttoken := 'Tpengenal';
                 if token = 'Mulai' then
                    Ttoken := 'Tmulai';
                 if token = 'Jika' then
                    Ttoken:='Tjika';
                 if token='maka' then
                    Ttoken := 'Tmaka';
                 if token = 'div' then
                    Ttoken := 'Tdiv';
                 if token ='Beda' then
                    Ttoken := 'Tbeda';
                 if token ='mod' then
                    Ttoken :='Tmod';
                 if token = 'Selesai' then
                    Ttoken := 'Tselesai';
                    output;
                    token := '';
              end;
              if (y in['0'..'9']) then
              begin
                 repeat
                    begin
                         token := token + y;
                         input;
                    end;
                 until (not(y in['0'..'9']));
                       Ttoken := 'Tbulat';
                       output;
                       token := '';
              end;
              if (y in[':','=',';','.']) then
              begin
                 repeat
                    begin
                         token := token + y;
                         input;
                    end;
                 until (not(y in[':','=',';','.']));
                 if token =':=' then
                    Ttoken := 'Tmasuk';
                 if token ='=' then
                    Ttoken := 'Tsama';
                 if token ='.' then
                    Ttoken := 'Ttitik';
                 if token =';' then
                    Ttoken := 'Ttkoma';
                    output;
                    token := '';
              end;
     until y = '#';
end;
begin
     scan;
     readln;
end.
Saturday, March 14, 2009
Subscribe to:
Post Comments (Atom)
nice post . tapi kok pas di run, cuma keluar cmd kosong gga bisa di apa-apain? pencerahannya dong cc??
ReplyDeletevisit n folback ya! http://wildan-hilmi27.blogspot.com
salam kenal :*
terima kasih, tutorialnya sangat membantu..
ReplyDelete^^
eror gitu bututtttt..
ReplyDelete