{$APPTYPE CONSOLE}
program Project1;
uses
  PaxCompiler, PaxProgram, PaxRegister,
  IMPORT_COMMON;
var
  PaxCompiler1: TPaxCompiler;
  PaxProgram1: TPaxProgram;
  PaxPascalLanguage1: TPaxPascalLanguage;
begin
  PaxCompiler1 := TPaxCompiler.Create(nil);
  PaxProgram1 := TPaxProgram.Create(nil);
  PaxPascalLanguage1 := TPaxPascalLanguage.Create(nil);
  try
    PaxCompiler1.RegisterLanguage(PaxPascalLanguage1);
    PaxCompiler1.AddModule('1', 'Pascal');
    PaxCompiler1.AddCodeFromFile('1', 'script.txt');
    if PaxCompiler1.Compile(PaxProgram1) then
    begin
      CreateDllFile('MinMax.dll',
                    PaxProgram1,
                    'PaxCompilerRun.dll', 'ScriptDllMain');
    end
    else
      writeln(PaxCompiler1.ErrorMessage[0]);
  finally
    PaxCompiler1.Free;
    PaxProgram1.Free;
    PaxPascalLanguage1.Free;
  end;
  writeln('Press any key...');
  Readln;
end.
