Appendices
Syntax cheat sheet, reserved words, operators and precedence, standard routines reference, dialect and version history, learning resources and suggested study plan (12 weeks).
Appendices
45.1 Syntax cheat sheet 45.2 Reserved words Turbo/ISO Pascal core: and array asm begin case const constructor destructor div do downto else end file for function goto if implementation in inherited inline interface label mod nil not object of or packed procedure program record repeat set shl shr string then to type unit until uses var while with xor
Object Pascal additions (Delphi and FPC): as class dispinterface except exports finalization finally initialization is library on out property raise resourcestring threadvar try
FPC-specific reserved words: operator self (objfpc mode), generic specialize (objfpc mode)
Directives (context-sensitive; usable as identifiers but best avoided): absolute abstract assembler automated cdecl default deprecated dispid dynamic experimental export external far final forward helper implements index message name near nodefault overload override package pascal platform private protected public published read readonly reference register reintroduce requires resident safecall sealed static stdcall stored strict unsafe varargs virtual winapi write writeonly 45.3 Operators and precedence
@ not unary + unary - ^ (dereference) * / div mod and shl shr as + - or xor = <> < > <= >= in is FPC: offset/difference integer division, remainder and, or, xor, not subset/superset (<=, >=) ** (FPC, overloaded in Math) 45.4 Standard routines reference
Ord Chr Succ Pred Inc Dec Low High Odd Abs Sqr Sqrt Sin Cos ArcTan Exp Ln Pi Int Frac Trunc Round Random Randomize
Power IntPower Log10 Log2 LogN Ceil Floor Max Min Sum Mean Hypot Tan ArcSin ArcCos DegToRad RadToDeg SameValue IsNan IsInfinite EnsureRange RandomRange Strings (System)
Length SetLength Copy Pos Delete Insert Concat Str Val StringOfChar UpCase LowerCase (FPC) SetString Strings (SysUtils)
IntToStr StrToInt StrToIntDef TryStrToInt FloatToStr StrToFloat FormatFloat Format Trim TrimLeft TrimRight UpperCase LowerCase CompareStr CompareText SameText StringReplace QuotedStr IntToHex BoolToStr Strings (StrUtils)
LeftStr RightStr MidStr PosEx ReverseString DupeString StartsText EndsText ContainsText AnsiReplaceStr IfThen SplitString (Delphi)
New Dispose GetMem FreeMem AllocMem ReallocMem FillChar Move SizeOf Assigned Addr Ptr Default Initialize Finalize
SetLength Length High Low Copy Insert Delete Concat Write Writeln Read Readln Eof Eoln AssignFile Reset Rewrite Append CloseFile Flush IOResult Typed/untyped files
Seek FilePos FileSize Truncate BlockRead BlockWrite Erase Rename Files (SysUtils)
FileExists DirectoryExists DeleteFile RenameFile CreateDir ForceDirectories FindFirst FindNext FindClose ExtractFileName ExtractFilePath ExtractFileExt ChangeFileExt IncludeTrailingPathDelimiter GetCurrentDir Date/time (SysUtils, DateUtils)
Now Date Time DateToStr TimeToStr DateTimeToStr FormatDateTime EncodeDate DecodeDate IncDay DaysBetween YearOf MonthOf DayOfWeek
Halt Exit Break Continue RunError Abort Assert Sleep ParamCount ParamStr GetEnvironmentVariable
FreeAndNil Supports and TObject.ClassName ClassType InheritsFrom Free 45.5 Dialect and version history Implementation / version Pascal (Wirth) structured programming, strong typing, records, sets, pointers p-code VM, units, strings ISO 7185; Turbo Pascal 1.0 standard; integrated editor and fast compiler Turbo Pascal 4.0 units, .TPU files Turbo Pascal 5.5 object type (OOP) ISO 10206 Extended Pascal modules, schemata, and_then/or_else, string types Borland Pascal 7 protected mode, open arrays, const parameters classes, exceptions, properties, RTTI, VCL 32-bit, AnsiString, Variant dynamic arrays, overloading, default parameters, Int64 Free Pascal 1.0 multi-platform open-source compiler Delphi 2005/2006; FPC 2.0
for-in, strict visibility, records with methods (2006), operator overloading for records
Unicode string, generics, anonymous methods extended RTTI, attributes Win64, macOS, FireMonkey stable cross-platform RAD IDE Delphi XE4/XE5 code-page-aware strings, delphiunicode mode, helpers, JVM/Android targets inline variables, type inference; Community Edition Delphi 10.4; FPC 3.2.0 custom managed records, ARC removed; generic functions, management operators, dynamic array operators Delphi 11; FPC 3.2.2 high-DPI IDE, Apple Silicon target (11.x); FPC bug-fix release Delphi 12; Lazarus 3.0 multi-line strings, Skia integration
Delphi 12.1–12.3; Lazarus 4.x; Delphi 13 64-bit IDE (12.3), conditional if expressions (13); FPC trunk 3.3.1 with function references and anonymous functions 45.6 Learning resources Official documentation:
Free Pascal documentation (freepascal.org/docs): Reference Guide, Programmer's Guide, RTL and FCL references
Free Pascal & Lazarus Wiki (wiki.freepascal.org) — tutorials, FAQs, platform notes
Embarcadero DocWiki (docwiki.embarcadero.com) — Delphi language guide, RTL, VCL, FMX, FireDAC Free online tutorials:
*Modern Object Pascal Introduction for Programmers* — Michalis Kamburelis (castle-engine.io)
*Free Pascal From Square One* — Jeff Duntemann (free PDF) *Object Pascal Handbook* — Marco Cantù (Delphi edition; free with registration at Embarcadero) learndelphi.org, Delphi and Lazarus YouTube channels (Embarcadero, Lazarus team, Castle Game Engine) *awesome-pascal* curated list on GitHub
*Pascal User Manual and Report* — Kathleen Jensen & Niklaus Wirth
*Algorithms + Data Structures = Programs* — Niklaus Wirth *Object Pascal Handbook* (Delphi 10.4/11 editions) — Marco Cantù *Mastering Delphi* series — Marco Cantù
*Coding in Delphi* and *More Coding in Delphi* — Nick Hodges
*Delphi High Performance* — Primož Gabrijelčič *Hands-On Design Patterns with Delphi* — Primož Gabrijelčič
*Delphi Cookbook* — Daniele Spinetti & Daniele Teti *Lazarus: The Complete Guide* — Blaise Pascal Magazine team
Community: Lazarus & Free Pascal forum (forum.lazarus.freepascal.org), Delphi-PRAXiS (en.delphipraxis.net), Stack Overflow [delphi]/[freepascal]/[lazarus] tags, r/delphi, r/lazarus, r/pascal, Embarcadero blogs, Blaise Pascal Magazine, FPC/Lazarus mailing lists and GitLab repositories.
45.7 Suggested study plan (12 weeks) History, tools, first programs, lexical rules
Data types, constants, operators, type conversion, I/O Decisions and loops — Part I exercises, Capstone 1
Procedures, functions, parameters, recursion Arrays, records, sets, strings
Pointers, linked structures, files, units — Capstone 2 Exceptions, compiler directives — Part II exercises, Capstone 3
Classes, properties, inheritance, metaclasses, interfaces Generics, anonymous methods, operators, helpers, enumerators, RTTI
Memory management, threads, C interop, dialects — Part III exercises
GUI, databases, networking, JSON/XML — Capstones 4 and 5 Cross-platform, packages, testing, debugging, best practices — Capstone 6, 7, or 8 🎓 Final Words
You have travelled from Niklaus Wirth's clean teaching language to modern Object Pascal: classes and interfaces, generics and closures, RTTI, multithreading, cross-platform GUIs, databases, and web services. Pascal's strengths — readable code, strong typing, fast compilation, and native performance — are as valuable today as they were in 1970. Keep your directives explicit, free what you create, test what you build, and explore the friendly Free Pascal, Lazarus, and Delphi communities. Build the capstone projects, read good open-source Pascal code (Lazarus, mORMot, Castle Game Engine, Spring4D), and enjoy programming in a language designed for clarity. Happy coding! 🚀
program Cheat; // or: unit Name; interface ... implementation ... end.
{$mode objfpc}{$H+} // FPC; Delphi console: {$APPTYPE CONSOLE}
uses SysUtils, Classes;
const
Max = 10; // constant
Names: array[0..1] of string = ('a', 'b'); // typed constant
type
TColor = (Red, Green, Blue); // enumeration
TDigits = set of 0..9; // set
TPoint = record X, Y: Integer; end;
PNode = ^TNode; // pointer
TNode = record Value: Integer; Next: PNode; end;
TIntArray = array of Integer; // dynamic array
TAnimal = class // class
private
FName: string;
public
constructor Create(const AName: string);
function Speak: string; virtual;
property Name: string read FName;
end;
var
I: Integer;
S: string;
A: TIntArray;
constructor TAnimal.Create(const AName: string);
begin
inherited Create;
FName := AName;
end;
function TAnimal.Speak: string;
begin
Result := FName + ' makes a sound';
end;
function Add(A, B: Integer): Integer; // function
begin
Result := A + B;
end;
procedure Swap(var X, Y: Integer); // var parameter
var T: Integer
…