Sign in Join
Wiki copytemporary

Standard Pascal: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Standard Pascal

OldNewLine
1+In 1974, the creator of the [[Pascal]] language, [[Niklaus Wirth]] wrote a book with Kathleen Jensen, titled *[[Pascal User Manual and Report]]* published by Springer-Verlag. This book became a de-facto standard for the Pascal language. In 1983 the International Standards Organization (ISO) formalized the de-facto standard as ISO 7185:1983. In 1990 ISO released an updated version - ISO 7185:1990 - that didn't introduce any new concepts, but cleared up ambiguities and corrected errors that were in the earlier version. The ISO 7185 standard is referred to as **Standard Pascal**. The standard defines the minimum level that a [[Compiler|Pascal compiler]] must support in order to be a true compiler of the Pascal language.
2+
3+## [[Reserved word|Reserved Words]]
4+
5+The following are the standard [[Keyword|keywords]] (referred to as *word-symbols* in the ISO 7185) that all compilers must support:
6+
7+- [[And|and]]
8+- [[Array|array]]
9+- [[Begin|begin]]
10+- [[Case|case]]
11+- [[Const|const]]
12+- [[Div|div]]
13+- [[Do|do]]
14+- [[Downto|downto]]
15+- [[Else|else]]
16+- [[End|end]]
17+- [[File|file]]
18+- [[For|for]]
19+- [[Function|function]]
20+- [[Goto|goto]]
21+- [[If|if]]
22+- [[In|in]]
23+- [[Label|label]]
24+- [[Mod|mod]]
25+- [[Nil|nil]]
26+- [[Not|not]]
27+- [[Of|of]]
28+- [[Or|or]]
29+- [[Packed|packed]]
30+- [[Procedure|procedure]]
31+- [[Program|program]]
32+- [[Record|record]]
33+- [[Repeat|repeat]]
34+- [[Set|set]]
35+- [[Then|then]]
36+- [[To|to]]
37+- [[Type|type]]
38+- [[Until|until]]
39+- [[Var|var]]
40+- [[While|while]]
41+- [[With|with]]
42+
43+## Symbols
44+
45+The following symbols (which the standard refers to as *special-symbols*) are also part of the language:
46+
47+- \+ ([[Plus|plus]])
48+
49+- \- ([[Minus|minus]])
50+
51+- * ([[*|asterisk]])
52+
53+- / ([[Slash|slash]])
54+
55+- = ([[Equal|equal]])
56+
57+- \< ([[Less than|less than]])
58+
59+- \> ([[Greater than|greater than]])
60+
61+- \[
62+
63+- \]
64+
65+- . ([[period]])
66+
67+- , ([[Comma|comma]])
68+
69+-
70+ ([[Colon|colon]])
71+
72+- ; ([[;|semicolon]])
73+
74+- ↑
75+
76+- (
77+
78+- )
79+
80+- \<\> ([[Not equal|not equal]])
81+
82+- \<=
83+
84+- \>=
85+
86+-
87+ = (named [[Becomes|becomes]])
88+
89+- ..
90+
91+## Functions
92+
93+All of the functions defined by Standard Pascal are implemented in Free Pascal in the [[System unit]] of the standard [[RTL|Runtime Library]].
94+
95+### Arithmetic Functions
96+
97+| Function | Description |
98+|----|----|
99+| abs(x) | Calculate the absolute value of x |
100+| arctan(x) | arctan returns the arctangent of x, which can be any Real type. The resulting angle is in radial units. |
101+| cos(x) | Calculate cosine of angle x ([[Radian|radians]]) |
102+| exp(x) | Exp returns the exponent of x, i.e. the number e to the power x |
103+| ln(x) | returns the natural logarithm of the Real parameter x. x must be positive. |
104+| sin(x) | Calculate the sine of angle x (radians) |
105+| sqr(x) | Calculate the square of x |
106+| sqrt(x) | Calculate the square root of x. x must be positive. |
107+| | |
108+
109+### Transfer Functions
110+
111+| Function | Description |
112+|----|----|
113+| [[Round|round]](x) | Round floating point value to nearest integer number and return as integer. |
114+| [[Trunc|trunc]](x) | Truncate floating point x value and return as integer. |
115+| | |
116+
117+### Ordinal Functions
118+
119+| Function | Description |
120+|----|----|
121+| [[Chr|chr]](x) | Convert byte value to a character value |
122+| [[Ord|ord]](x) | Return ordinal value of an ordinal type. |
123+| [[Pred|pred]](x) | Return previous element for an ordinal type. |
124+| [[Succ|succ]](x) | Return next element of ordinal type. |
125+| | |
126+
127+### Boolean Functions
128+
129+| Function | Description |
130+|----|----|
131+| [[EOLN and EOF|eof]](f) | Check for end of file f |
132+| [[EOLN and EOF|eoln]](f) | Check for end of line on textfile f |
133+| [[Odd|odd]](x) | Is a x odd or even ? |
134+| | |
135+
136+## Procedures
137+
138+Procedures defined by Standard Pascal are implemented in Free Pascal in the [[System unit]] of the standard [[RTL|Runtime Library]].
139+
140+### File handling procedures
141+
142+| Procedure | Description |
143+|----|----|
144+| [[Get|get]](f) | |
145+| [[Page|page]]() | |
146+| [[Put|put]](f) | |
147+| [[Read|read]] | Read from a text file or stdin into a [[Variable|variable]] |
148+| [[Read|readln]] | Read from a text file into variable and goto next line |
149+| [[Reset|reset]](f) | Open file for reading |
150+| [[Rewrite|rewrite]](f) | Open file for writing |
151+| [[Write|write]] | Write variable or literal string to a text file or stdout |
152+| [[Write|writeln]] | Write variable or literal string to a text file or stdout and append newline |
153+| | |
154+
155+### Dynamic allocation procedures
156+
157+| Procedure | Description |
158+|----|----|
159+| [[Dispose|dispose]](q) | Release the memory pointed to by q, which was allocated with a call to New. |
160+| dispose(q,k1...kn) | |
161+| [[New|new]](p) | New allocates a new instance of the type pointed to by p, and puts the address in p. |
162+| new(p,c1...cn) | |
163+| | |
164+
165+### Transfer procedures
166+
167+| Procedure | Description |
168+|-----------|-----------------------------------------|
169+| pack() | Create packed array from normal array |
170+| unpack() | Create unpacked array from packed array |
171+| | |
172+
173+## Extensions
174+
175+There are additional keywords which are not technically part of the Standard Pascal language but are used by [[FPC]] either for additional functionality such as for implementing objects, compatibility with the error recovery concepts exposed by C++, or to provide compatibility with [[Borland Pascal]] and earlier Pascal compilers. These keywords include:
176+
177+
178+[[Implementation|implementation]] · [[Finally|finally]] · [[Try|try]] · [[Unit|unit]].
179+
180+## Types
181+
182+There are the standard [[Type|types]]:
183+
184+[[Integer|integer]] · [[Smallint|smallint]] · [[Longint|longint]] · [[Real|real]] · [[Boolean|boolean]] · [[String|string]] · [[Char|char]] · [[Byte|byte]]
185+
186+## Modes supported by Free Pascal
187+
188+Free Pascal supports ISO 7185 Standard Pascal with the [[Compiler Mode|compiler mode]] [[Command-line interface|command line]] option **-Miso** or with the [[Source code|source code]] [[Compiler directive|compiler directive]] [[Mode iso|{$mode ISO}]]. Support of ISO 7185 started with version 3.0.0. It is planned to have a mode support ISO/IEC 10206 [[Extended Pascal]] in future versions of Free Pascal.
189+
190+## External links
191+
192+- [Standard Pascal](http://www.standardpascal.org), reference information about the ANSI ISO 7185 standard.
193+- [ISO 7185:1990](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=13802), official normative version of the Pascal standard.
194+- [ISO/IEC 10206:1991](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=18237): Extended Pascal standard
195+
196+---
197+*From the Free Pascal wiki, page "Standard Pascal", as it stood on 2023-09-11 after a change by Chernov, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history