RemObjects PascalScriptを試す

今更だけど、RemObjects PascalScriptをDelphi2009で動かしてみた。
Pascal Script | RemObjects Software
これはInno Setupスクリプトエンジンに使われてるのが有名かな。
フォームにPSScriptコンポーネントを貼りつけて、以下のコードで動かした。

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, uPSComponent;

type
  TForm1 = class(TForm)
    PSScript1: TPSScript;
    Memo1: TMemo;
    Button1: TButton;
    Memo2: TMemo;
    procedure Button1Click(Sender: TObject);
    procedure PSScript1Compile(Sender: TPSScript);
  private
    procedure WriteOut(const S: String);
  public
    { Public 宣言 }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Memo2.Clear;
  PSScript1.Script.Text := Memo1.Text;
  if PSScript1.Compile then
    PSScript1.Execute
  else
    Memo2.Text := 'compile error!';
end;

procedure TForm1.PSScript1Compile(Sender: TPSScript);
begin
  Sender.AddMethod(Self, @TForm1.WriteOut,
      'procedure WriteOut(const S: string)');
end;

procedure TForm1.WriteOut(const S: String);
begin
  Memo2.Lines.Add(S);
end;

end.

これでコンパイルしたら実行ファイルのサイズは826KBだった。

日本語も問題ないみたいでいい感じ。