Pascal Language Structure
Total Page:16
File Type:pdf, Size:1020Kb
TMT Pascal Multi-target Edition Version 3.50 (Build 2.50) Programmer’s Reference 2000 2 Programmer’s Reference Contents 1 The TMT Pascal Language Description ............................................................................. 8 1.1 Features ............................................................................................................................... 8 Overview ............................................................................................................................... 8 Compilation targets................................................................................................................ 8 Language extensions.............................................................................................................. 8 1.2 Implementation Issues ......................................................................................................... 9 Memory Organization............................................................................................................ 9 Calling Conventions ............................................................................................................ 10 Limitations........................................................................................................................... 11 1.3 Pascal Language Structure................................................................................................. 11 Tokens and Identifiers ......................................................................................................... 11 Reserved Words................................................................................................................... 12 Operators and Delimiters..................................................................................................... 12 Operator Precedence............................................................................................................ 13 Constants ............................................................................................................................. 13 Program Comments ............................................................................................................. 14 1.4 Types ................................................................................................................................. 14 Boolean Types..................................................................................................................... 15 Character Types................................................................................................................... 15 Integer Types....................................................................................................................... 16 Enumeration Types.............................................................................................................. 16 Subrange Types ................................................................................................................... 17 Real Types........................................................................................................................... 17 Pointer Types....................................................................................................................... 17 Pointer Dereference .............................................................................................................18 Array Types......................................................................................................................... 18 String Types......................................................................................................................... 18 Set Types ............................................................................................................................. 19 Record Types....................................................................................................................... 19 File Types ............................................................................................................................ 20 Procedure Types .................................................................................................................. 21 Object Types........................................................................................................................ 22 Type Compatibility..............................................................................................................22 1.5 Declarations....................................................................................................................... 22 Type Declarations................................................................................................................ 23 Label Declarations............................................................................................................... 23 Constant Declarations.......................................................................................................... 23 Variable Declarations .......................................................................................................... 24 Local Block Declarations .................................................................................................... 25 1.6 Expressions........................................................................................................................ 26 Arithmetic Operators ........................................................................................................... 26 Boolean Operators...............................................................................................................27 Set Operators ....................................................................................................................... 27 Relational Operators............................................................................................................27 Typecasts ............................................................................................................................. 28 TMT PASCAL 3 Developer Guide Operator Precedence ............................................................................................................28 1.7 Statements..........................................................................................................................28 Assigments...........................................................................................................................28 Compound Statements .........................................................................................................29 Case Statement.....................................................................................................................29 For Statement.......................................................................................................................30 Goto Statement.....................................................................................................................30 If Statement..........................................................................................................................31 InLine Statement..................................................................................................................31 Repeat Statement .................................................................................................................31 While Statement...................................................................................................................32 With Statement.....................................................................................................................32 Mem, MemW, MemL, and MemD ......................................................................................32 Port, PortW and PortD .........................................................................................................33 1.8 Programs and Units............................................................................................................33 Units.....................................................................................................................................33 Programs ..............................................................................................................................34 1.9 Dynamic-Link Libraries (DLL’s) ......................................................................................35 About DLL’s........................................................................................................................35 Using DLLs..........................................................................................................................36 Writing DLLs.......................................................................................................................37 Global variables in DLLs.....................................................................................................38 Import Units.........................................................................................................................38 1.10 Procedures and Functions ................................................................................................38 Procedures and Functions Declaration.................................................................................38 Forward Declaration ............................................................................................................39