xdpw
1.0.0

내 아버지 Mikhail Tereshkov에게 헌신 한 공학의 취향
XD Pascal은 Pascal Language Dialect를위한 소규모 자조 호스팅 컴파일러입니다. 의견, 제안 또는 버그 보고서에 감사드립니다. github 또는 이메일 [email protected]로 저자에게 문의하십시오. 즐기다.

명령 프롬프트를 입력하십시오.
xdpw <file.pas>
소스 파일은 Extension (.pas)으로 지정되어야합니다.
XD Pascal은 Delphi 6/7 및 Free Pascal과 유사합니다.
Text 유형은 file 과 같습니다. 텍스트와 유형의 파일에 사용할 수 있습니다.Extended Double 과 동일합니다High Low 기능이 없습니다. 열린 배열 길이는 서브 루틴으로 명시 적으로 전달되어야합니다. ProgramOrUnit = [("program" | "unit") Ident ";"]
["interface"] [UsesClause] Block "." .
UsesClause = "uses" Ident {"," Ident} ";" .
Block = { Declarations } (CompoundStatement | "end") .
Declarations = DeclarationSection ["implementation" DeclarationSection] .
DeclarationSection = LabelDeclarations |
ConstDeclarations |
TypeDeclarations |
VarDeclarations |
ProcFuncDeclarations .
Initializer = ConstExpression |
StringLiteral |
"(" Initializer {"," Initializer} ")" |
"(" Ident ":" Initializer {";" Ident ":" Initializer} ")" |
SetConstructor .
LabelDeclarations = "label" Ident {"," Ident} ";"
ConstDeclarations = (UntypedConstDeclaration | TypedConstDeclaration)
{";" (UntypedConstDeclaration | TypedConstDeclaration)} .
UntypedConstDeclaration = "const" Ident "=" ConstExpression .
TypedConstDeclaration = "const" Ident ":" Type "=" Initializer .
TypeDeclarations = "type" Ident "=" Type ";" {Ident "=" Type ";"} .
VarDeclarations = "var" IdentList ":" Type ["=" Initializer] ";"
{IdentList ":" Type ["=" Initializer] ";"} .
ProcFuncDeclarations = ("procedure" | "function") Ident
[Receiver] [FormalParams] [":" TypeIdent]
[CallModifier] ";" [(Directive | Block) ";"] .
Receiver = "for" Ident ":" TypeIdent .
CallModifier = "stdcall" | "cdecl" .
Directive = "forward" | "external" ConstExpression .
ActualParams = "(" [ (Expression | Designator) |
{"," (Expression | Designator)} ] ")" .
FormalParams = "(" FormalParamList {";" FormalParamList} ")" .
FormalParamList = ["const" | "var"] IdentList [":" ["array" "of"] TypeIdent]
["=" ConstExpression] .
IdentList = Ident {"," Ident} .
Type = "(" Ident {"," Ident} ")" |
"^" TypeIdent |
["packed"] "array" "[" Type {"," Type} "]" "of" Type |
["packed"] "record" Fields "end" |
["packed"] "interface" FixedFields "end" |
["packed"] "set" "of" Type |
["packed"] "string" [ "[" ConstExpression "]" ] |
["packed"] "file" ["of" Type] |
ConstExpression ".." ConstExpression |
("procedure" | "function") [FormalParams] [":" TypeIdent] [CallModifier] |
Ident .
Fields = FixedFields
["case" [Ident ":"] Type "of"
ConstExpression {"," ConstExpression} ":" "(" Fields ")"
{";" ConstExpression {"," ConstExpression} ":" "(" Fields ")"}] [";"] .
FixedFields = IdentList ":" Type {";" IdentList ":" Type} .
TypeIdent = "string" | "file" | Ident .
Designator = BasicDesignator {Selector} .
BasicDesignator = Ident |
Ident [ActualParams] |
Ident "(" Expression ")" .
Selector = "^" |
"[" Expression {"," Expression} "]" |
"." Ident |
"(" ActualParams ")".
Statement = [Label ":"] [ (Designator | Ident) ":=" Expression |
(Designator | Ident) [ActualParams] {Selector} |
CompoundStatement |
IfStatement |
CaseStatement |
WhileStatement |
RepeatStatement |
ForStatement |
GotoStatement |
WithStatement ] .
Label = Ident .
StatementList = Statement {";" Statement} .
CompoundStatement = "begin" StatementList "end" .
IfStatement = "if" Expression "then" Statement ["else" Statement] .
CaseStatement = "case" Expression "of" CaseElement {";" CaseElement}
[";"] ["else" StatementList] [";"] "end" .
WhileStatement = "while" Expression "do" Statement .
RepeatStatement = "repeat" StatementList "until" Expression .
ForStatement = "for" Ident ":=" Expression ("to" | "downto") Expression "do" Statement.
GotoStatement = "goto" Label .
WithStatement = "with" Designator {"," Designator} "do" Statement .
CaseElement = CaseLabel {"," CaseLabel} ":" Statement .
CaseLabel = ConstExpression [".." ConstExpression] .
ConstExpression = Expression .
Expression = SimpleExpression [("="|"<>"|"<"|"<="|">"|">="|"in") SimpleExpression] .
SimpleExpression = ["+"|"-"] Term {("+"|"-"|"or"|"xor") Term}.
Term = Factor {("*"|"/"|"div"|"mod"|"shl"|"shr"|"and") Factor}.
Factor = (Designator | Ident) [ActualParams] {Selector} |
Designator |
"@" Designator |
Number |
CharLiteral |
StringLiteral |
"(" Expression ")" |
"not" Factor |
SetConstructor |
"nil" |
Ident "(" Expression ")" {Selector} .
SetConstructor = "[" [Expression [".." Expression]
{"," Expression [".." Expression]}] "]" .
Ident = (Letter | "_") {Letter | "_" | Digit}.
Number = "$" HexDigit {HexDigit} |
Digit {Digit} ["." {Digit}] ["e" ["+" | "-"] Digit {Digit}] .
CharLiteral = "'" (Character | "'" "'") "'" |
"#" Number .
StringLiteral = "'" {Character | "'" "'"} "'".
컴파일러는 재귀 하강 파서를 기반으로합니다. 외부 어셈블러 또는 링커를 사용하지 않고 Windows PE 실행 파일을 직접 구축합니다.
$APPTYPE 애플리케이션 유형을 설정합니다. 예제 : {$APPTYPE GUI} , {$APPTYPE CONSOLE}$UNITPATH 추가 단위 검색 경로를 설정합니다. 예 : {$UNITPATH ..units} 일부 간단한 구멍 최적화가 수행됩니다.
다음 식별자는 컴파일러의 일부로 구현됩니다. 그들의 이름은 예약 된 단어가 아니며 사용자가 로컬로 재정의 할 수 있습니다.
procedure Inc ( var x: Integer);
procedure Dec ( var x: Integer);
procedure Read ([ var F: file ;] var x1 { ; var xi } );
procedure Write ([ var F: file ;] x1[:w[:d]] { ; xi[:w[:d]] } );
procedure ReadLn ([ var F: file ;] var x1 { ; var xi } );
procedure WriteLn ([ var F: file ;] x1[:w[:d]] { ; xi[:w[:d]] } );
procedure New ( var P: Pointer);
procedure Dispose ( var P: Pointer);
procedure Break ;
procedure Continue ;
procedure Exit ;
procedure Halt [( const error: Integer)];
function SizeOf ( var x | T): Integer;
function Ord (x: T): Integer;
function Chr (x: Integer): Char;
function Low ( var x: T | T): T;
function High ( var x: T | T): T;
function Pred (x: T): T;
function Succ (x: T): T;
function Round (x: Real): Integer;
function Abs (x: T): T;
function Sqr (x: T): T;
function Sin (x: Real): Real;
function Cos (x: Real): Real;
function Arctan (x: Real): Real;
function Exp (x: Real): Real;
function Ln (x: Real): Real;
function SqRt (x: Real): Real; function Timer : Integer;
procedure GetMem ( var P: Pointer; Size: Integer);
procedure FreeMem ( var P: Pointer);
procedure Randomize ;
function Random : Real;
procedure Assign ( var F: file ; const Name : string);
procedure Rewrite ( var F: file [; BlockSize: Integer]);
procedure Reset ( var F: file [; BlockSize: Integer]);
procedure Close ( var F: file );
procedure BlockRead ( var F: file ; var Buf; Len: Integer; var LenRead: Integer);
procedure BlockWrite ( var F: file ; var Buf; Len: Integer);
procedure Seek ( var F: file ; Pos: Integer);
function FileSize ( var F: file ): Integer;
function FilePos ( var F: file ): Integer;
function EOF ( var F: file ): Boolean;
function IOResult : Integer;
function Length ( const s: string): Integer;
procedure Move ( var Source; var Dest; Count: Integer);
function Copy ( const S: string; Index, Count: Integer): string;
procedure FillChar ( var Data; Count: Integer; Value : Char);
function ParamCount : Integer;
function ParamStr (Index: Integer): string;
procedure Val ( const s: string; var Number: Real; var Code: Integer);
procedure Str (Number: Real; var s: string[; DecPlaces: Integer]);
procedure IVal ( const s: string; var Number: Integer; var Code: Integer);
procedure IStr (Number: Integer; var s: string);
function UpCase (ch: Char): Char; function IntToStr (n: Integer): string;
function StrToInt ( const s: string): Integer;
function FloatToStr (x: Real): string;
function FloatToStrF (x: Real; Format: TFloatFormat; Precision, Digits: Integer): string;
function StrToFloat ( const s: string): Real;
function StrToPChar ( const s: string): PChar;
function PCharToStr (p: PChar): string;
function StrToPWideChar ( const s: string): PWideChar;
function PWideCharToStr (p: PWideChar): string;factor.pas 정수 인수 분석 데모lineq.pas 선형 방정식 솔버. gauss.pas 단위를 사용합니다. eq.txt , eqerr.txt 또는 유사한 데이터 파일이 필요합니다life.pas 삶의 게임sort.pas 배열 정렬 데모fft.pas 빠른 푸리에 변환 데모inserr.pas 관성 내비게이션 시스템 오류 추정 데모. kalman.pas 단위를 사용합니다list.pas 링크 된 목록 작업 데모map.pas 이종 목록 작업 및 맵 함수 데모. XD 파스칼 방법 및 인터페이스를 보여줍니다gui.pas -GUI 애플리케이션 데모. windows.pas 단위를 사용합니다raytracer.pas -Raytracer 데모. XD 파스칼 방법 및 인터페이스를 보여줍니다. raytracer.go 와 동일합니다 
Windows Defender Antivirus는 XD Pascal과 함께 컴파일 된 일부 프로그램에서 잘못된 긍정적 인 결과를 제공하는 것으로 알려져 있습니다.