Ignore:
Timestamp:
Apr 17, 2020, 12:09:15 AM (5 years ago)
Author:
chronos
Message:
  • Added: Support for String, Integer and Boolean types.
  • Added: Support for more system defined functions..
  • Added: Support for line comments.
  • Added: For-To-Do construction.
  • Added: Defined function parameters and and parsing function calls with parameters.
  • Modified: Improved handling of expressions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/interpreter2/Test.pas

    r200 r202  
     1// Line comment
    12program Test;
    23var
    3   A;
    4   B;
     4  A: string;
     5  B: string;
     6  X: string;
     7  I: Integer;
    58const
    6   C = 1;
     9  C: Integer = 1;
    710begin 
    8   A := 2;
    9   B := C;
     11  X := 'A' + 'B';
     12  WriteLn(X);
     13  A := IntToStr(2);
     14  B := IntToStr(C);
    1015  A := B;
    11   if A then begin
     16 
     17  // If-Then-Else
     18  if A = '2' then begin
    1219    WriteLn('DoThen');
    1320  end else WriteLn('DoElse');
    1421
    15   A := '';
    16   while A do begin
    17     WriteLn(A);
     22  // While-Do
     23  I := 5;
     24  while I <> 0 do begin
     25    WriteLn(IntToStr(I));
     26    I := I - 1;
     27  end;
     28 
     29  // For-To-Do
     30  for I := 0 to 5 do begin
     31    WriteLn(IntToStr(I));   
    1832  end;
    1933   
     34  // Begin-End
    2035  begin
    2136    WriteLn('Hello World!');
Note: See TracChangeset for help on using the changeset viewer.