   砭 :

 D1,2,C++ Builder: ⥪   樨.
                            㣨 ᨬ, 20.06.1997, 05.11.1997, 26.02.98
                            FidoNet:2:5020/484.28
                            mailto: belugin@bsd.lanit.ru
                            http://www.geocities.com/SiliconValley/Pines/1605

⠢⥫ 㭮 ᥩ ⮫쥢.
                            mailto: alexs@n10.ft.stavropol.ru
                            FidoNet:2:5064/13.50

 ⠭   ᮧ  :comp_belugin.dpk 

1. ⠭   Delphi 4.0 㦭  ᫥騥 ப
 (ᯮ ⥪ RxLib)
 䠩 Comped;
   砫 䠩 塞
   {$I RX.INC}
  ࠧ ᫥ ᯨ᪠ 祭 㫥 uses
   {$IFDEF RX_D4}
   type
      TDesigner = IDesigner;
      TFormDesigner = IFormDesigner;
   {$ENDIF}
 ⮦ ᠬ  䠩 Execed;

2.ꥪ⭠ 㠫쭠 設
䠩 ObjOps.pas:
⮤:
function TOrOp.DoOp;
         begin
           Result:=Inherited DoOp(a,b);
           Result.AsBoolean:=a.AsBoolean and b.AsBoolean;
         end;                         // ^^^
   
function TOrOp.DoOp;
         begin
           Result:=Inherited DoOp(a,b);
           Result.AsBoolean:=a.AsBoolean or b.AsBoolean; 
         end;                         // ^^

3.   - ⮡ ३ ࠡ⠫
OpList:
function    TOpList.Find;
            Var i:Integer;
            begin
              Result:=nil;
              for i:=0 to fList.Count-1 do
              begin
                if (fList.Obj[i] as TObjOp).OpCode=OpCode then
                begin
                  Result:=fList.Obj[i] as TObjOp;
                  exit;//!!! (c) alexs
                end;
              end;
            end;

4. ⮡ 뢠 ଠ ।   㤠 TCompiler-
 Compiler;

  {TCompiler provides lexical and grammar parse }
  TCompiler = class(TComponent)
  private
    { Private declarations }
    fLexems:TLexInfLs;
            ....
            ....
            ....
    procedure wrOnCompile(Rule:Integer;a:TRuleEvent);
  public
    fEditWind:TObject;      //(c) alexs
    {}
    procedure write(w:TWRiter);
    procedure read(r:TReader);

destructor TCompiler.Destroy;
            begin
              if fEditWind<>nil then //(c) by alexs
                 fEditWind.Free;

 Comped;
constructor TCompEdForm.Create;
            Var i:Integer;
            begin
              Inherited Create(o);
              Comp.fEditWind:=Self; //(c) alexs
              fComp:=Comp;
            ....
            ....
            ....

procedure TCompEdForm.FormDestroy(Sender: TObject);
begin
  Comp.fEditWind:=nil; //(c) alexs
{  Modif;
  ReadRLFromS(fComp.Rules,RulesGrid.Cols[1],fComp.Lexems);
  fErrEd.Destroy;                                         }
end;

5. ⮡  ६ 樨 ⮡ࠦ ண:

᫥   TCompiler-a  ⨯:
  TCompilerProgress = procedure(Sender: TCompiler; LineNo: Integer) of object;

 ਢ⭮  TCompiler  ६
    fOnCompilerProgress:TCompilerProgress;

  㡫  ᢮⢮
    property OnCompilerProgress:TCompilerProgress read fOnCompilerProgress write fOnCompilerProgress;

९襬 ⮤ TCompiler.AcceptStrings ᫥. ࠧ
function TCompiler.AcceptStrings;
          Var i:integer;
          begin
            for i:=0 to s.COunt-1 do
            begin
              if not AcceptString(LineNo+i,s[i]) then
              begin
                Result:=False;
                break;
              end;
              if Assigned(OnCompilerProgress) then //(c) alex
                 OnCompilerProgress(Self, i);
            end;
          end;

6.  室 ࢠ 믮 ਯ.
⮬ ᤥ ᫥騥 

 㫥 uObjVM;
   ६  ⮤ procedure IObjVM.Run 
  २  Executor  뭥   ꥪ IObjVM.

       ⮤:
procedure IObjVM.Halt;
begin
  Executor.IsEnd:=true;
end;

7.  ꥪ TCode  ⮤ (  㤮 ࠭  
 -䠩, ⮡     䠩)
 Code;
{Load code from stream}
procedure TCode.LoadFromStream(S:TStream);
var r:TReader;
begin
  r:=TReader.Create(S,1024);
  Size:=r.ReadInteger;
  r.Read(Body^,Size);
  r.Free;
end;

{Save code to stream}
procedure TCode.SaveToStream(S:TStream);
var w:TWriter;
begin
  w:=TWriter.Create(S,1024);
  w.writeInteger(Size);
  w.write(Body^,Size);
  w.Free;
end;

