<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0049)https://miasap.se/obnc/oberon-report.html#sec10.2 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-
- <meta name="author" content="Niklaus Wirth">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>The Programming Language Oberon</title>
-
- <style type="text/css">
- body {
- line-height: 1.25;
- max-width: 77ex; /*CSS2*/
- margin-left: auto;
- margin-right: auto;
- padding-left: 1em;
- padding-right: 1em;
- text-align: justify
- }
-
- body, pre {
- font-family: Helvetica, Freesans, Arial, sans-serif
- }
-
- dfn {
- font-style: italic
- }
-
- div.dl,
- div.table,
- ol {
- margin-left: 0;
- padding-left: 2.5em
- }
-
- div.header {
- text-align: center
- }
-
- div.header p.revision,
- h2,
- span.author {
- font-size: 1.2em
- }
-
- div.header blockquote {
- margin-bottom: 2.5em
- }
-
- div.header blockquote,
- div.header blockquote p,
- p.author,
- p.revision {
- margin-bottom: 0.4em;
- margin-top: 0.4em
- }
-
- dl, ol, p, pre {
- margin-bottom: 0.5em;
- margin-top: 0.5em
- }
-
- pre {
- margin-left: 2.5em
- }
-
- dt {
- font-weight: normal
- }
-
- h1 {
- font-size: 1.6em;
- margin-bottom: 0.4em;
- margin-top: 2.5em
- }
-
- h2, h3, h4 {
- margin-bottom: 0.5em;
- margin-top: 1em
- }
-
- h2.toc {
- margin-top: 2.5em
- }
-
- h2.toc,
- h3,
- h4 {
- font-size: 1em
- }
-
- h4 {
- font-weight: normal;
- font-style: italic
- }
-
- pre {
- -moz-tab-size: 5;
- -o-tab-size: 5;
- tab-size: 5 /*CSS3*/
- }
-
- table {
- border-spacing: 0 /*CSS2*/
- }
-
- table.header tr.second td,
- tr.group-first td {
- padding-top: 0.5em
- }
-
- td, th {
- padding-left: 1.5em;
- padding-right: 1.5em;
- vertical-align: text-top;
- white-space: nowrap
- }
+
+ <meta name="author" content="Niklaus Wirth">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>The Programming Language Oberon</title>
+
+ <style type="text/css">
+ body {
+ line-height: 1.25;
+ max-width: 77ex; /*CSS2*/
+ margin-left: auto;
+ margin-right: auto;
+ padding-left: 1em;
+ padding-right: 1em;
+ text-align: justify
+ }
+
+ body, pre {
+ font-family: Helvetica, Freesans, Arial, sans-serif
+ }
+
+ dfn {
+ font-style: italic
+ }
+
+ div.dl,
+ div.table,
+ ol {
+ margin-left: 0;
+ padding-left: 2.5em
+ }
+
+ div.header {
+ text-align: center
+ }
+
+ div.header p.revision,
+ h2,
+ span.author {
+ font-size: 1.2em
+ }
+
+ div.header blockquote {
+ margin-bottom: 2.5em
+ }
+
+ div.header blockquote,
+ div.header blockquote p,
+ p.author,
+ p.revision {
+ margin-bottom: 0.4em;
+ margin-top: 0.4em
+ }
+
+ dl, ol, p, pre {
+ margin-bottom: 0.5em;
+ margin-top: 0.5em
+ }
+
+ pre {
+ margin-left: 2.5em
+ }
+
+ dt {
+ font-weight: normal
+ }
+
+ h1 {
+ font-size: 1.6em;
+ margin-bottom: 0.4em;
+ margin-top: 2.5em
+ }
+
+ h2, h3, h4 {
+ margin-bottom: 0.5em;
+ margin-top: 1em
+ }
+
+ h2.toc {
+ margin-top: 2.5em
+ }
+
+ h2.toc,
+ h3,
+ h4 {
+ font-size: 1em
+ }
+
+ h4 {
+ font-weight: normal;
+ font-style: italic
+ }
+
+ pre {
+ -moz-tab-size: 5;
+ -o-tab-size: 5;
+ tab-size: 5 /*CSS3*/
+ }
+
+ table {
+ border-spacing: 0 /*CSS2*/
+ }
+
+ table.header tr.second td,
+ tr.group-first td {
+ padding-top: 0.5em
+ }
+
+ td, th {
+ padding-left: 1.5em;
+ padding-right: 1.5em;
+ vertical-align: text-top;
+ white-space: nowrap
+ }
- td.first, th.first {
- padding-left: 0
- }
+ td.first, th.first {
+ padding-left: 0
+ }
- td.last, th.last {
- padding-right: 0
- }
+ td.last, th.last {
+ padding-right: 0
+ }
- th {
- text-align: left;
- font-weight: normal;
- border-bottom: 1px solid
- }
- </style>
- </head>
- <body>
- <div class="header">
- <h1>The Programming Language Oberon</h1>
+ th {
+ text-align: left;
+ font-weight: normal;
+ border-bottom: 1px solid
+ }
+ </style>
+ </head>
+ <body>
+ <div class="header">
+ <h1>The Programming Language Oberon</h1>
- <p class="revision">Revision 1.10.2013 / 3.5.2016 / 2021</p>
+ <p class="revision">Revision 1.10.2013 / 3.5.2016 / 2021</p>
- <p class="author">
- <span class="author">Niklaus Wirth</span><br>
- <small>(HTML translation from PDF by Karl Landström)</small><br>
- <small>(Further revisions by Michael D. Lowis)</small>
- </p>
+ <p class="author">
+ <span class="author">Niklaus Wirth</span><br>
+ <small>(HTML translation from PDF by Karl Landström)</small><br>
+ <small>(Further revisions by Michael D. Lowis)</small>
+ </p>
- <blockquote>
- <p><em>Make it as simple as possible, but not simpler.</em> (A. Einstein)</p>
- </blockquote>
- </div>
+ <blockquote>
+ <p><em>Make it as simple as possible, but not simpler.</em> (A. Einstein)</p>
+ </blockquote>
+ </div>
- <h2 class="toc">Table of Contents</h2>
+ <h2 class="toc">Table of Contents</h2>
- <ol>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec1">History and introduction</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec2">Syntax</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec3">Vocabulary</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec4">Declarations and scope rules</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec5">Constant declarations</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec6">Type declarations</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec7">Variable declarations</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec8">Expressions</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec9">Statements</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec10">Procedure declarations</a></li>
- <li><a href="https://miasap.se/obnc/oberon-report.html#sec11">Modules</a></li>
- </ol>
+ <ol>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#preface">Preface</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec1">History and introduction</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec2">Syntax</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec3">Vocabulary</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec4">Declarations and scope rules</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec5">Constant declarations</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec6">Type declarations</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec7">Variable declarations</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec8">Expressions</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec9">Statements</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec10">Procedure declarations</a></li>
+ <li><a href="https://miasap.se/obnc/oberon-report.html#sec11">Modules</a></li>
+ </ol>
- <p>Appendix: <a href="https://miasap.se/obnc/oberon-report.html#appendix">The Syntax of Oberon</a></p>
+ <p>Appendix: <a href="https://miasap.se/obnc/oberon-report.html#appendix">The Syntax of Oberon</a></p>
- <h2><a name="sec1">1. Introduction</a></h2>
+ <h2><a name="sec1">Preface</a></h2>
- <p>Oberon is a general-purpose programming language that evolved from Modula-2. Its principal new feature is the concept of type extension. It permits the construction of new data types on the basis of existing ones and to relate them.</p>
+ <p>This document started as a direct copy of Niklaus Wirth's Oberon07 specification that has been incrementally revised and refactored to create an essentially new language. Most of the changes are cosmetic and serve to "modernize" the language. The changes so far ar as follows:
+ <ul>
+ <li>All keywords, operators, and predeclared identifiers are lower case or camel case rather than all upper case</li>
+ <li>Predeclared identifiers have been renamed to reflect intent and behavior</li>
+ <li>Removed PACK, ROR, UNPCK, ASR, LSL predeclared identifiers</li>
+ <li>Removed the SET types and associated operators</li>
+ <li>Changed not equal operator from '#' to '!='</li>
+ </ul>
+ </p>
- <p>This report is not intended as a programmer's tutorial. It is intentionally kept concise. Its function is to serve as a reference for programmers, implementors, and manual writers. What remains unsaid is mostly left so intentionally, either because it is derivable from stated rules of the language, or because it would unnecessarily restrict the freedom of implementors.</p>
+ <p></p>
- <p>This document describes the language defined in 1988/90 as revised in 2007 / 2016 / 2021.</p>
+ <h2><a name="sec1">1. Introduction</a></h2>
- <h2><a name="sec2">2. Syntax</a></h2>
+ <p>Oberon is a general-purpose programming language that evolved from Modula-2. Its principal new feature is the concept of type extension. It permits the construction of new data types on the basis of existing ones and to relate them.</p>
- <p>A language is an infinite set of sentences, namely the sentences well formed according to its syntax. In Oberon, these sentences are called compilation units. Each unit is a finite sequence of <dfn>symbols</dfn> from a finite vocabulary. The vocabulary of Oberon consists of identifiers, numbers, strings, operators, delimiters, and comments. They are called <dfn>lexical symbols</dfn> and are composed of sequences of <dfn>characters</dfn>. (Note the distinction between symbols and characters.)</p>
+ <p>This report is not intended as a programmer's tutorial. It is intentionally kept concise. Its function is to serve as a reference for programmers, implementors, and manual writers. What remains unsaid is mostly left so intentionally, either because it is derivable from stated rules of the language, or because it would unnecessarily restrict the freedom of implementors.</p>
- <p>To describe the syntax, an extended Backus-Naur Formalism called EBNF is used. Brackets [ and ] denote optionality of the enclosed sentential form, and braces { and } denote its repetition (possibly 0 times). Syntactic entities (non-terminal symbols) are denoted by English words expressing their intuitive meaning. Symbols of the language vocabulary (terminal symbols) are denoted by strings enclosed in quote marks or by words in capital letters.</p>
+ <p>This document describes the language defined in 1988/90 as revised in 2007 / 2016 / 2021.</p>
- <h2><a name="sec3">3. Vocabulary</a></h2>
+ <h2><a name="sec2">2. Syntax</a></h2>
- <p>The following lexical rules must be observed when composing symbols. Blanks and line breaks must not occur within symbols (except in comments, and blanks in strings). They are ignored unless they are essential to separate two consecutive symbols. Capital and lower-case letters are considered as being distinct.</p>
+ <p>A language is an infinite set of sentences, namely the sentences well formed according to its syntax. In Oberon, these sentences are called compilation units. Each unit is a finite sequence of <dfn>symbols</dfn> from a finite vocabulary. The vocabulary of Oberon consists of identifiers, numbers, strings, operators, delimiters, and comments. They are called <dfn>lexical symbols</dfn> and are composed of sequences of <dfn>characters</dfn>. (Note the distinction between symbols and characters.)</p>
- <p><dfn>Identifiers</dfn> are sequences of letters and digits. The first character must be a letter.</p>
+ <p>To describe the syntax, an extended Backus-Naur Formalism called EBNF is used. Brackets [ and ] denote optionality of the enclosed sentential form, and braces { and } denote its repetition (possibly 0 times). Syntactic entities (non-terminal symbols) are denoted by English words expressing their intuitive meaning. Symbols of the language vocabulary (terminal symbols) are denoted by strings enclosed in quote marks or by words in capital letters.</p>
- <pre>ident = letter {letter | digit}.
+ <h2><a name="sec3">3. Vocabulary</a></h2>
+
+ <p>The following lexical rules must be observed when composing symbols. Blanks and line breaks must not occur within symbols (except in comments, and blanks in strings). They are ignored unless they are essential to separate two consecutive symbols. Capital and lower-case letters are considered as being distinct.</p>
+
+ <p><dfn>Identifiers</dfn> are sequences of letters and digits. The first character must be a letter.</p>
+
+ <pre>ident = letter {letter | digit}.
</pre>
- <p>Examples:</p>
+ <p>Examples:</p>
- <pre>x scan Oberon GetSymbol firstLetter
+ <pre>x scan Oberon GetSymbol firstLetter
</pre>
- <p><dfn>Numbers</dfn> are (unsigned) integers or real numbers. Integers are sequences of digits and may be followed by a suffix letter. If no suffix is specified, the representation is decimal. The suffix H indicates hexadecimal representation.</p>
+ <p><dfn>Numbers</dfn> are (unsigned) integers or real numbers. Integers are sequences of digits and may be followed by a suffix letter. If no suffix is specified, the representation is decimal. The suffix H indicates hexadecimal representation.</p>
- <p>A <dfn>real number</dfn> always contains a decimal point. Optionally it may also contain a decimal scale factor. The letter E is pronounced as “times ten to the power of”.</p>
+ <p>A <dfn>real number</dfn> always contains a decimal point. Optionally it may also contain a decimal scale factor. The letter E is pronounced as “times ten to the power of”.</p>
- <pre>number = integer | real.
+ <pre>number = integer | real.
integer = digit {digit} | digit {hexDigit} "H".
real = digit {digit} "." {digit} [ScaleFactor].
ScaleFactor = "E" ["+" | "-"] digit {digit}.
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9".
</pre>
- <p>Examples:</p>
-
- <div class="table">
- <table>
- <tbody><tr>
- <td class="first">1987</td>
- <td class="last"></td>
- </tr>
- <tr>
- <td class="first">100H</td>
- <td class="last">= 256</td>
- </tr>
- <tr>
- <td class="first">12.3</td>
- <td class="last"></td>
- </tr>
- <tr>
- <td class="first">4.567E8</td>
- <td class="last">= 456700000</td>
- </tr>
- </tbody></table>
- </div>
-
- <p><dfn>Strings</dfn> are sequences of characters enclosed in quote marks ("). A string cannot contain the delimiting quote mark. Alternatively, a single-character string may be specified by the ordinal number of the character in hexadecimal notation followed by an "X". The number of characters in a string is called the length of the string.</p>
-
- <pre>string = """ {character} """ | digit {hexdigit} "X" .
-</pre>
-
- <p>Examples:</p>
-
- <pre>"OBERON" "Don't worry!" 22X
-</pre>
-
- <p><dfn>Operators</dfn> and <dfn>delimiters</dfn> are the special characters, character pairs, or reserved words listed below. These reserved words cannot be used in the role of identifiers.</p>
-
- <div class="table">
- <table>
- <tbody><tr>
- <td class="first">+</td>
- <td>:=</td>
- <td>array</td>
- <td>import</td>
- <td class="last">then</td>
- </tr>
- <tr>
- <td class="first">-</td>
- <td>^</td>
- <td>begin</td>
- <td>in</td>
- <td class="last">to</td>
- </tr>
- <tr>
- <td class="first">*</td>
- <td>=</td>
- <td>by</td>
- <td>is</td>
- <td class="last">true</td>
- </tr>
- <tr>
- <td class="first">/</td>
- <td>#</td>
- <td>case</td>
- <td>mod</td>
- <td class="last">type</td>
- </tr>
- <tr>
- <td class="first">~</td>
- <td><</td>
- <td>const</td>
- <td>module</td>
- <td class="last">until</td>
- </tr>
- <tr>
- <td class="first">&</td>
- <td>></td>
- <td>div</td>
- <td>nil</td>
- <td class="last">var</td>
- </tr>
- <tr>
- <td class="first">.</td>
- <td><=</td>
- <td>do</td>
- <td>of</td>
- <td class="last">while</td>
- </tr>
- <tr>
- <td class="first">,</td>
- <td>>=</td>
- <td>else</td>
- <td class="last">or</td>
- </tr>
- <tr>
- <td class="first">;</td>
- <td>..</td>
- <td>elsif</td>
- <td class="last">pointer</td>
- </tr>
- <tr>
- <td class="first">|</td>
- <td>:</td>
- <td>end</td>
- <td class="last">procedure</td>
- </tr>
- <tr>
- <td class="first">(</td>
- <td>)</td>
- <td>false</td>
- <td class="last">record</td>
- </tr>
- <tr>
- <td class="first">[</td>
- <td>]</td>
- <td>for</td>
- <td class="last">repeat</td>
- </tr>
- <tr>
- <td class="first">{</td>
- <td>}</td>
- <td>if</td>
- <td class="last">return</td>
- </tr>
- </tbody></table>
- </div>
-
- <p><dfn>Comments</dfn> may be inserted between any two symbols in a program. They are arbitrary character sequences opened by the bracket (* and closed by *). Comments do not affect the meaning of a program. They may be nested.</p>
-
- <h2><a name="sec4">4. Declarations and scope rules</a></h2>
-
- <p>Every identifier occurring in a program must be introduced by a declaration, unless it is a predefined identifier. Declarations also serve to specify certain permanent properties of an object, such as whether it is a constant, a type, a variable, or a procedure.</p>
-
- <p>The identifier is then used to refer to the associated object. This is possible in those parts of a program only which are within the <dfn>scope</dfn> of the declaration. No identifier may denote more than one object within a given scope. The scope extends textually from the point of the declaration to the end of the block (procedure or module) to which the declaration belongs and hence to which the object is local.</p>
-
- <p>In its declaration, an identifier in the module's scope may be followed by an export mark (*) to indicate that it be <dfn>exported</dfn> from its declaring module. In this case, the identifier may be used in other modules, if they import the declaring module. The identifier is then prefixed by the identifier designating its module (see Ch. 11). The prefix and the identifier are separated by a period and together are called a <dfn>qualified identifier</dfn>.</p>
-
- <pre>qualident = [ident "."] ident.
+ <p>Examples:</p>
+
+ <div class="table">
+ <table>
+ <tbody><tr>
+ <td class="first">1987</td>
+ <td class="last"></td>
+ </tr>
+ <tr>
+ <td class="first">100H</td>
+ <td class="last">= 256</td>
+ </tr>
+ <tr>
+ <td class="first">12.3</td>
+ <td class="last"></td>
+ </tr>
+ <tr>
+ <td class="first">4.567E8</td>
+ <td class="last">= 456700000</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p><dfn>Strings</dfn> are sequences of characters enclosed in quote marks ("). A string cannot contain the delimiting quote mark. Alternatively, a single-character string may be specified by the ordinal number of the character in hexadecimal notation followed by an "X". The number of characters in a string is called the length of the string.</p>
+
+ <pre>string = """ {character} """ | digit {hexdigit} "X" .
+</pre>
+
+ <p>Examples:</p>
+
+ <pre>"OBERON" "Don't worry!" 22X
+</pre>
+
+ <p><dfn>Operators</dfn> and <dfn>delimiters</dfn> are the special characters, character pairs, or reserved words listed below. These reserved words cannot be used in the role of identifiers.</p>
+
+ <div class="table">
+ <table>
+ <tbody><tr>
+ <td class="first">+</td>
+ <td>:=</td>
+ <td>array</td>
+ <td>import</td>
+ <td class="last">then</td>
+ </tr>
+ <tr>
+ <td class="first">-</td>
+ <td>^</td>
+ <td>begin</td>
+ <td>in</td>
+ <td class="last">to</td>
+ </tr>
+ <tr>
+ <td class="first">*</td>
+ <td>=</td>
+ <td>by</td>
+ <td>is</td>
+ <td class="last">true</td>
+ </tr>
+ <tr>
+ <td class="first">/</td>
+ <td>#</td>
+ <td>case</td>
+ <td>mod</td>
+ <td class="last">type</td>
+ </tr>
+ <tr>
+ <td class="first">~</td>
+ <td><</td>
+ <td>const</td>
+ <td>module</td>
+ <td class="last">until</td>
+ </tr>
+ <tr>
+ <td class="first">&</td>
+ <td>></td>
+ <td>div</td>
+ <td>nil</td>
+ <td class="last">var</td>
+ </tr>
+ <tr>
+ <td class="first">.</td>
+ <td><=</td>
+ <td>do</td>
+ <td>of</td>
+ <td class="last">while</td>
+ </tr>
+ <tr>
+ <td class="first">,</td>
+ <td>>=</td>
+ <td>else</td>
+ <td class="last">or</td>
+ </tr>
+ <tr>
+ <td class="first">;</td>
+ <td>..</td>
+ <td>elsif</td>
+ <td class="last">pointer</td>
+ </tr>
+ <tr>
+ <td class="first">|</td>
+ <td>:</td>
+ <td>end</td>
+ <td class="last">procedure</td>
+ </tr>
+ <tr>
+ <td class="first">(</td>
+ <td>)</td>
+ <td>false</td>
+ <td class="last">record</td>
+ </tr>
+ <tr>
+ <td class="first">[</td>
+ <td>]</td>
+ <td>for</td>
+ <td class="last">repeat</td>
+ </tr>
+ <tr>
+ <td class="first">{</td>
+ <td>}</td>
+ <td>if</td>
+ <td class="last">return</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p><dfn>Comments</dfn> may be inserted between any two symbols in a program. They are arbitrary character sequences opened by the bracket (* and closed by *). Comments do not affect the meaning of a program. They may be nested.</p>
+
+ <h2><a name="sec4">4. Declarations and scope rules</a></h2>
+
+ <p>Every identifier occurring in a program must be introduced by a declaration, unless it is a predefined identifier. Declarations also serve to specify certain permanent properties of an object, such as whether it is a constant, a type, a variable, or a procedure.</p>
+
+ <p>The identifier is then used to refer to the associated object. This is possible in those parts of a program only which are within the <dfn>scope</dfn> of the declaration. No identifier may denote more than one object within a given scope. The scope extends textually from the point of the declaration to the end of the block (procedure or module) to which the declaration belongs and hence to which the object is local.</p>
+
+ <p>In its declaration, an identifier in the module's scope may be followed by an export mark (*) to indicate that it be <dfn>exported</dfn> from its declaring module. In this case, the identifier may be used in other modules, if they import the declaring module. The identifier is then prefixed by the identifier designating its module (see Ch. 11). The prefix and the identifier are separated by a period and together are called a <dfn>qualified identifier</dfn>.</p>
+
+ <pre>qualident = [ident "."] ident.
identdef = ident ["*"].
</pre>
- <p>The following identifiers are predefined; their meaning is defined in <a href="https://miasap.se/obnc/oberon-report.html#sec6.1">section 6.1</a> (types) or <a href="https://miasap.se/obnc/oberon-report.html#sec10.2">10.2</a> (procedures):</p>
+ <p>The following identifiers are predefined; their meaning is defined in <a href="https://miasap.se/obnc/oberon-report.html#sec6.1">section 6.1</a> (types) or <a href="https://miasap.se/obnc/oberon-report.html#sec10.2">10.2</a> (procedures):</p>
- <div class="table">
- <table>
- <tbody><tr>
- <td>Abs</td>
- <td>AsChar</td>
- <td>AsInt</td>
- <td>AsReal</td>
+ <div class="table">
+ <table>
+ <tbody><tr>
+ <td>Abs</td>
+ <td>AsChar</td>
+ <td>AsInt</td>
+ <td>AsReal</td>
</tr>
- <tr>
- <td>Assert</td>
- <td>Bool</td>
- <td>Byte</td>
- <td>Char</td>
+ <tr>
+ <td>Assert</td>
+ <td>Bool</td>
+ <td>Byte</td>
+ <td>Char</td>
</tr>
- <tr>
- <td>Decrement</td>
- <td>Floor</td>
- <td>Increment</td>
- <td>Int</td>
+ <tr>
+ <td>Decrement</td>
+ <td>Floor</td>
+ <td>Increment</td>
+ <td>Int</td>
</tr>
- <tr>
- <td>Length</td>
- <td>New</td>
- <td>Real</td>
+ <tr>
+ <td>Length</td>
+ <td>New</td>
+ <td>Real</td>
</tr>
- </tbody></table>
- </div>
+ </tbody></table>
+ </div>
- <h2><a name="sec5">5. Constant declarations</a></h2>
+ <h2><a name="sec5">5. Constant declarations</a></h2>
- <p>A constant declaration associates an identifier with a constant value.</p>
+ <p>A constant declaration associates an identifier with a constant value.</p>
- <pre>ConstDeclaration = identdef "=" ConstExpression.
+ <pre>ConstDeclaration = identdef "=" ConstExpression.
ConstExpression = expression.
</pre>
- <p>A constant expression can be evaluated by a mere textual scan without actually executing the program. Its operands are constants (see <a href="https://miasap.se/obnc/oberon-report.html#sec8">Ch. 8</a>). Examples of constant declarations are:</p>
+ <p>A constant expression can be evaluated by a mere textual scan without actually executing the program. Its operands are constants (see <a href="https://miasap.se/obnc/oberon-report.html#sec8">Ch. 8</a>). Examples of constant declarations are:</p>
- <pre>N = 100
+ <pre>N = 100
</pre>
- <pre>limit = 2*N - 1
+ <pre>limit = 2*N - 1
</pre>
- <pre>all = {0 .. WordSize - 1}
+ <pre>all = {0 .. WordSize - 1}
</pre>
- <pre>name = "Oberon"
+ <pre>name = "Oberon"
</pre>
- <h2><a name="sec6">6. Type declarations</a></h2>
+ <h2><a name="sec6">6. Type declarations</a></h2>
- <p>A data type determines the set of values which variables of that type may assume, and the operators that are applicable. A type declaration is used to associate an identifier with a type. The types define the structure of variables of this type and, by implication, the operators that are applicable to components. There are two different data structures, namely arrays and records, with different component selectors.</p>
+ <p>A data type determines the set of values which variables of that type may assume, and the operators that are applicable. A type declaration is used to associate an identifier with a type. The types define the structure of variables of this type and, by implication, the operators that are applicable to components. There are two different data structures, namely arrays and records, with different component selectors.</p>
- <pre>TypeDeclaration = identdef "=" type.
+ <pre>TypeDeclaration = identdef "=" type.
type = qualident | ArrayType | RecordType | PointerType | ProcedureType.
</pre>
- <p>Examples:</p>
+ <p>Examples:</p>
- <pre>Table = ARRAY N OF REAL
+ <pre>Table = ARRAY N OF REAL
</pre>
- <pre>Tree = POINTER TO Node
+ <pre>Tree = POINTER TO Node
</pre>
- <pre>Node = RECORD key: INTEGER;
- left, right: Tree
+ <pre>Node = RECORD key: INTEGER;
+ left, right: Tree
END
</pre>
- <pre>CenterNode = RECORD (Node)
- name: ARRAY 32 OF CHAR;
- subnode: Tree
+ <pre>CenterNode = RECORD (Node)
+ name: ARRAY 32 OF CHAR;
+ subnode: Tree
END
</pre>
- <pre>Function = PROCEDURE (x: INTEGER): INTEGER
+ <pre>Function = PROCEDURE (x: INTEGER): INTEGER
</pre>
- <h3><a name="sec6.1">6.1. Basic types</a></h3>
+ <h3><a name="sec6.1">6.1. Basic types</a></h3>
- <p>The following basic types are denoted by predeclared identifiers. The associated operators are defined in <a href="https://miasap.se/obnc/oberon-report.html#sec8.2">8.2</a>, and the predeclared function procedures in <a href="https://miasap.se/obnc/oberon-report.html#sec10.2">10.2</a>. The values of a given basic type are the following:</p>
+ <p>The following basic types are denoted by predeclared identifiers. The associated operators are defined in <a href="https://miasap.se/obnc/oberon-report.html#sec8.2">8.2</a>, and the predeclared function procedures in <a href="https://miasap.se/obnc/oberon-report.html#sec10.2">10.2</a>. The values of a given basic type are the following:</p>
- <div class="dl">
- <dl>
- <dt>BOOLEAN</dt>
- <dd>the truth values TRUE and FALSE</dd>
+ <div class="dl">
+ <dl>
+ <dt>BOOLEAN</dt>
+ <dd>the truth values TRUE and FALSE</dd>
- <dt>CHAR</dt>
- <dd>the characters of a standard character set</dd>
+ <dt>CHAR</dt>
+ <dd>the characters of a standard character set</dd>
- <dt>INTEGER</dt>
- <dd>the integers</dd>
+ <dt>INTEGER</dt>
+ <dd>the integers</dd>
- <dt>REAL</dt>
- <dd>real numbers</dd>
+ <dt>REAL</dt>
+ <dd>real numbers</dd>
- <dt>BYTE</dt>
- <dd>the integers between 0 and 255</dd>
+ <dt>BYTE</dt>
+ <dd>the integers between 0 and 255</dd>
- <dt>SET</dt>
- <dd>the sets of integers between 0 and an implementation-dependent limit</dd>
- </dl>
- </div>
+ <dt>SET</dt>
+ <dd>the sets of integers between 0 and an implementation-dependent limit</dd>
+ </dl>
+ </div>
- <p>The type BYTE is compatible with the type INTEGER, and vice-versa.</p>
+ <p>The type BYTE is compatible with the type INTEGER, and vice-versa.</p>
- <h3><a name="sec6.2">6.2. Array types</a></h3>
+ <h3><a name="sec6.2">6.2. Array types</a></h3>
- <p>An array is a structure consisting of a fixed number of elements which are all of the same type, called the <dfn>element type</dfn>. The number of elements of an array is called its <dfn>length</dfn>. The elements of the array are designated by indices, which are integers between 0 and the length minus 1.</p>
+ <p>An array is a structure consisting of a fixed number of elements which are all of the same type, called the <dfn>element type</dfn>. The number of elements of an array is called its <dfn>length</dfn>. The elements of the array are designated by indices, which are integers between 0 and the length minus 1.</p>
- <pre>ArrayType = ARRAY length {"," length} OF type.
+ <pre>ArrayType = ARRAY length {"," length} OF type.
length = ConstExpression.
</pre>
- <p>A declaration of the form</p>
+ <p>A declaration of the form</p>
- <pre>ARRAY N0, N1, ... , Nk OF T
+ <pre>ARRAY N0, N1, ... , Nk OF T
</pre>
- <p>is understood as an abbreviation of the declaration</p>
+ <p>is understood as an abbreviation of the declaration</p>
- <pre>ARRAY N0 OF
- ARRAY N1 OF
- ...
- ARRAY Nk OF T
+ <pre>ARRAY N0 OF
+ ARRAY N1 OF
+ ...
+ ARRAY Nk OF T
</pre>
- <p>Examples of array types:</p>
+ <p>Examples of array types:</p>
- <pre>ARRAY N OF INTEGER
+ <pre>ARRAY N OF INTEGER
</pre>
- <pre>ARRAY 10, 20 OF REAL
+ <pre>ARRAY 10, 20 OF REAL
</pre>
- <h3><a name="sec6.3">6.3. Record types</a></h3>
+ <h3><a name="sec6.3">6.3. Record types</a></h3>
- <p>A record type is a structure consisting of a fixed number of elements of possibly different types. The record type declaration specifies for each element, called <dfn>field</dfn>, its type and an identifier which denotes the field. The scope of these field identifiers is the record definition itself, but they are also visible within field designators (see <a href="https://miasap.se/obnc/oberon-report.html#sec8.1">8.1</a>) referring to elements of record variables.</p>
+ <p>A record type is a structure consisting of a fixed number of elements of possibly different types. The record type declaration specifies for each element, called <dfn>field</dfn>, its type and an identifier which denotes the field. The scope of these field identifiers is the record definition itself, but they are also visible within field designators (see <a href="https://miasap.se/obnc/oberon-report.html#sec8.1">8.1</a>) referring to elements of record variables.</p>
- <pre>RecordType = RECORD ["(" BaseType ")"] [FieldListSequence] END.
+ <pre>RecordType = RECORD ["(" BaseType ")"] [FieldListSequence] END.
BaseType = qualident.
FieldListSequence = FieldList {";" FieldList}.
FieldList = IdentList ":" type.
IdentList = identdef {"," identdef}.
</pre>
- <p>If a record type is exported, field identifiers that are to be visible outside the declaring module must be marked. They are called <dfn>public fields</dfn>; unmarked fields are called <dfn>private fields</dfn>.</p>
+ <p>If a record type is exported, field identifiers that are to be visible outside the declaring module must be marked. They are called <dfn>public fields</dfn>; unmarked fields are called <dfn>private fields</dfn>.</p>
- <p>Record types are extensible, i.e. a record type can be defined as an extension of another record type. In the examples above, <var>CenterNode</var> (directly) extends <var>Node</var>, which is the (direct) base type of <var>CenterNode</var>. More specifically, <var>CenterNode</var> extends <var>Node</var> with the fields <var>name</var> and <var>subnode</var>.</p>
+ <p>Record types are extensible, i.e. a record type can be defined as an extension of another record type. In the examples above, <var>CenterNode</var> (directly) extends <var>Node</var>, which is the (direct) base type of <var>CenterNode</var>. More specifically, <var>CenterNode</var> extends <var>Node</var> with the fields <var>name</var> and <var>subnode</var>.</p>
- <p><em>Definition</em>: A type <var>T</var> extends a type <var>T0</var>, if it equals <var>T0</var>, or if it directly extends an extension of <var>T0</var>. Conversely, a type <var>T0</var> is a base type of <var>T</var>, if it equals <var>T</var>, or if it is the direct base type of a base type of <var>T</var>.</p>
+ <p><em>Definition</em>: A type <var>T</var> extends a type <var>T0</var>, if it equals <var>T0</var>, or if it directly extends an extension of <var>T0</var>. Conversely, a type <var>T0</var> is a base type of <var>T</var>, if it equals <var>T</var>, or if it is the direct base type of a base type of <var>T</var>.</p>
- <p>Examples of record types:</p>
+ <p>Examples of record types:</p>
- <pre>RECORD day, month, year: INTEGER
+ <pre>RECORD day, month, year: INTEGER
END
</pre>
- <pre>RECORD
- name, firstname: ARRAY 32 OF CHAR;
- age: INTEGER;
- salary: REAL
+ <pre>RECORD
+ name, firstname: ARRAY 32 OF CHAR;
+ age: INTEGER;
+ salary: REAL
END
</pre>
- <h3><a name="sec6.4">6.4. Pointer types</a></h3>
+ <h3><a name="sec6.4">6.4. Pointer types</a></h3>
- <p>Variables of a pointer type <var>P</var> assume as values pointers to variables of some type <var>T</var>. It must be a record type. The pointer type <var>P</var> is said to be <dfn>bound to</dfn> <var>T</var>, and <var>T</var> is the pointer base type of <var>P</var>. Pointer types inherit the extension relation of their base types, if there is any. If a type T is an extension of <var>T0</var> and <var>P</var> is a pointer type bound to <var>T</var>, then <var>P</var> is also an extension of <var>P0</var>, <dfn>the pointer type bound to</dfn> <var>T0</var>.</p>
+ <p>Variables of a pointer type <var>P</var> assume as values pointers to variables of some type <var>T</var>. It must be a record type. The pointer type <var>P</var> is said to be <dfn>bound to</dfn> <var>T</var>, and <var>T</var> is the pointer base type of <var>P</var>. Pointer types inherit the extension relation of their base types, if there is any. If a type T is an extension of <var>T0</var> and <var>P</var> is a pointer type bound to <var>T</var>, then <var>P</var> is also an extension of <var>P0</var>, <dfn>the pointer type bound to</dfn> <var>T0</var>.</p>
- <pre>PointerType = POINTER TO type.
+ <pre>PointerType = POINTER TO type.
</pre>
- <p>If a type <var>P</var> is defined as POINTER TO <var>T</var>, the identifier <var>T</var> can be declared textually following the declaration of <var>P</var>, but [if so] it must lie within the same scope.</p>
+ <p>If a type <var>P</var> is defined as POINTER TO <var>T</var>, the identifier <var>T</var> can be declared textually following the declaration of <var>P</var>, but [if so] it must lie within the same scope.</p>
- <p>If <var>p</var> is a variable of type <var>P</var> = POINTER TO <var>T</var>, then a call of the predefined procedure NEW(<var>p</var>) has the following effect (see <a href="https://miasap.se/obnc/oberon-report.html#sec10.2">10.2</a>): A variable of type <var>T</var> is allocated in free storage, and a pointer to it is assigned to <var>p</var>. This pointer <var>p</var> is of type <var>P</var> and the referenced variable <var>p</var>^ is of type <var>T</var>. Failure of allocation results in <var>p</var> obtaining the value NIL. Any pointer variable may be assigned the value NIL, which points to no variable at all.</p>
+ <p>If <var>p</var> is a variable of type <var>P</var> = POINTER TO <var>T</var>, then a call of the predefined procedure NEW(<var>p</var>) has the following effect (see <a href="https://miasap.se/obnc/oberon-report.html#sec10.2">10.2</a>): A variable of type <var>T</var> is allocated in free storage, and a pointer to it is assigned to <var>p</var>. This pointer <var>p</var> is of type <var>P</var> and the referenced variable <var>p</var>^ is of type <var>T</var>. Failure of allocation results in <var>p</var> obtaining the value NIL. Any pointer variable may be assigned the value NIL, which points to no variable at all.</p>
- <h3><a name="sec6.5">6.5. Procedure types</a></h3>
+ <h3><a name="sec6.5">6.5. Procedure types</a></h3>
- <p>Variables of a procedure type <var>T</var> have a procedure (or NIL) as value. If a procedure <var>P</var> is assigned to a procedure variable of type <var>T</var>, the (types of the) formal parameters of <var>P</var> must be the same as those indicated in the formal parameters of <var>T</var>. The same holds for the result type in the case of a function procedure (see <a href="https://miasap.se/obnc/oberon-report.html#sec10.1">10.1</a>). <var>P</var> must not be declared local to another procedure, and neither can it be a standard procedure.</p>
+ <p>Variables of a procedure type <var>T</var> have a procedure (or NIL) as value. If a procedure <var>P</var> is assigned to a procedure variable of type <var>T</var>, the (types of the) formal parameters of <var>P</var> must be the same as those indicated in the formal parameters of <var>T</var>. The same holds for the result type in the case of a function procedure (see <a href="https://miasap.se/obnc/oberon-report.html#sec10.1">10.1</a>). <var>P</var> must not be declared local to another procedure, and neither can it be a standard procedure.</p>
- <pre>ProcedureType = PROCEDURE [FormalParameters].
+ <pre>ProcedureType = PROCEDURE [FormalParameters].
</pre>
- <h2><a name="sec7">7. Variable declarations</a></h2>
+ <h2><a name="sec7">7. Variable declarations</a></h2>
- <p>Variable declarations serve to introduce variables and associate them with identifiers that must be unique within the given scope. They also serve to associate fixed data types with the variables.</p>
+ <p>Variable declarations serve to introduce variables and associate them with identifiers that must be unique within the given scope. They also serve to associate fixed data types with the variables.</p>
- <pre>VariableDeclaration = IdentList ":" type.
+ <pre>VariableDeclaration = IdentList ":" type.
</pre>
- <p>Variables whose identifiers appear in the same list are all of the same type. Examples of variable declarations (refer to examples in <a href="https://miasap.se/obnc/oberon-report.html#sec6">Ch. 6</a>):</p>
+ <p>Variables whose identifiers appear in the same list are all of the same type. Examples of variable declarations (refer to examples in <a href="https://miasap.se/obnc/oberon-report.html#sec6">Ch. 6</a>):</p>
- <pre>i, j, k: INTEGER
+ <pre>i, j, k: INTEGER
</pre>
- <pre>x, y: REAL
+ <pre>x, y: REAL
</pre>
- <pre>p, q: BOOLEAN
+ <pre>p, q: BOOLEAN
</pre>
- <pre>s: SET
+ <pre>s: SET
</pre>
- <pre>f: Function
+ <pre>f: Function
</pre>
- <pre>a: ARRAY 100 OF REAL
+ <pre>a: ARRAY 100 OF REAL
</pre>
- <pre>w: ARRAY 16 OF
- RECORD ch: CHAR;
- count: INTEGER
- END
+ <pre>w: ARRAY 16 OF
+ RECORD ch: CHAR;
+ count: INTEGER
+ END
</pre>
- <pre>t: Tree
+ <pre>t: Tree
</pre>
- <h2><a name="sec8">8. Expressions</a></h2>
+ <h2><a name="sec8">8. Expressions</a></h2>
- <p>Expressions are constructs denoting rules of computation whereby constants and current values of variables are combined to derive other values by the application of operators and function procedures. Expressions consist of operands and operators. Parentheses may be used to express specific associations of operators and operands.</p>
+ <p>Expressions are constructs denoting rules of computation whereby constants and current values of variables are combined to derive other values by the application of operators and function procedures. Expressions consist of operands and operators. Parentheses may be used to express specific associations of operators and operands.</p>
- <h3><a name="sec8.1">8.1. Operands</a></h3>
+ <h3><a name="sec8.1">8.1. Operands</a></h3>
- <p>With the exception of sets and literal constants, i.e. numbers and strings, operands are denoted by <dfn>designators</dfn>. A designator consists of an identifier referring to the constant, variable, or procedure to be designated. This identifier may possibly be qualified by module identifiers (see <a href="https://miasap.se/obnc/oberon-report.html#sec4">Ch. 4</a> and <a href="https://miasap.se/obnc/oberon-report.html#sec11">11</a>), and it may be followed by selectors, if the designated object is an element of a structure.</p>
+ <p>With the exception of sets and literal constants, i.e. numbers and strings, operands are denoted by <dfn>designators</dfn>. A designator consists of an identifier referring to the constant, variable, or procedure to be designated. This identifier may possibly be qualified by module identifiers (see <a href="https://miasap.se/obnc/oberon-report.html#sec4">Ch. 4</a> and <a href="https://miasap.se/obnc/oberon-report.html#sec11">11</a>), and it may be followed by selectors, if the designated object is an element of a structure.</p>
- <p>If <var>A</var> designates an array, then <var>A</var>[<var>E</var>] denotes that element of <var>A</var> whose index is the current value of the expression <var>E</var>. The type of <var>E</var> must be of type INTEGER. A designator of the form <var>A</var>[<var>E1</var>, <var>E2</var>, ... , <var>En</var>] stands for <var>A</var>[<var>E1</var>][<var>E2</var>] ... [<var>En</var>]. If <var>p</var> designates a pointer variable, <var>p</var>^ denotes the variable which is referenced by <var>p</var>. If <var>r</var> designates a record, then <var>r</var>.<var>f</var> denotes the field <var>f</var> of <var>r</var>. If <var>p</var> designates a pointer, <var>p</var>.<var>f</var> denotes the field <var>f</var> of the record <var>p</var>^, i.e. the dot implies dereferencing and <var>p</var>.<var>f</var> stands for <var>p</var>^.<var>f</var>.</p>
+ <p>If <var>A</var> designates an array, then <var>A</var>[<var>E</var>] denotes that element of <var>A</var> whose index is the current value of the expression <var>E</var>. The type of <var>E</var> must be of type INTEGER. A designator of the form <var>A</var>[<var>E1</var>, <var>E2</var>, ... , <var>En</var>] stands for <var>A</var>[<var>E1</var>][<var>E2</var>] ... [<var>En</var>]. If <var>p</var> designates a pointer variable, <var>p</var>^ denotes the variable which is referenced by <var>p</var>. If <var>r</var> designates a record, then <var>r</var>.<var>f</var> denotes the field <var>f</var> of <var>r</var>. If <var>p</var> designates a pointer, <var>p</var>.<var>f</var> denotes the field <var>f</var> of the record <var>p</var>^, i.e. the dot implies dereferencing and <var>p</var>.<var>f</var> stands for <var>p</var>^.<var>f</var>.</p>
- <p>The <dfn>typeguard</dfn> <var>v</var>(<var>T0</var>) asserts that <var>v</var> is of type <var>T0</var> , i.e. it aborts program execution, if it is not of type <var>T0</var> . The guard is applicable, if</p>
+ <p>The <dfn>typeguard</dfn> <var>v</var>(<var>T0</var>) asserts that <var>v</var> is of type <var>T0</var> , i.e. it aborts program execution, if it is not of type <var>T0</var> . The guard is applicable, if</p>
- <ol>
- <li><var>T0</var> is an extension of the declared type <var>T</var> of <var>v</var>, and if</li>
- <li><var>v</var> is a variable parameter of record type, or <var>v</var> is a pointer.</li>
- </ol>
+ <ol>
+ <li><var>T0</var> is an extension of the declared type <var>T</var> of <var>v</var>, and if</li>
+ <li><var>v</var> is a variable parameter of record type, or <var>v</var> is a pointer.</li>
+ </ol>
- <pre>designator = qualident {selector}.
+ <pre>designator = qualident {selector}.
selector = "." ident | "[" ExpList "]" | "^" | "(" qualident ")".
ExpList = expression {"," expression}.
</pre>
- <p>If the designated object is a variable, then the designator refers to the variable's current value. If the object is a procedure, a designator without parameter list refers to that procedure. If it is followed by a (possibly empty) parameter list, the designator implies an activation of the procedure and stands for the value resulting from its execution. The (types of the) actual parameters must correspond to the formal parameters as specified in the procedure's declaration (see <a href="https://miasap.se/obnc/oberon-report.html#sec10">Ch. 10</a>).</p>
-
- <p>Examples of designators (see examples in <a href="https://miasap.se/obnc/oberon-report.html#sec7">Ch. 7</a>):</p>
-
- <div class="table">
- <table>
- <tbody><tr>
- <td class="first">i</td>
- <td class="last">(INTEGER)</td>
- </tr>
- <tr>
- <td class="first">a[i]</td>
- <td class="last">(REAL)</td>
- </tr>
- <tr>
- <td class="first">w[3].ch</td>
- <td class="last">(CHAR)</td>
- </tr>
- <tr>
- <td class="first">t.key</td>
- <td class="last">(INTEGER)</td>
- </tr>
- <tr>
- <td class="first">t.left.right</td>
- <td class="last">(Tree)</td>
- </tr>
- <tr>
- <td class="first">t(CenterNode).subnode</td>
- <td class="last">(Tree)</td>
- </tr>
- </tbody></table>
- </div>
-
- <h3><a name="sec8.2">8.2. Operators</a></h3>
-
- <p>The syntax of expressions distinguishes between four classes of operators with different precedences (binding strengths). The operator ~ has the highest precedence, followed by multiplication operators, addition operators, and relations. Operators of the same precedence associate from left to right. For example, <var>x</var> − <var>y</var> − <var>z</var> stands for (<var>x</var> − <var>y</var>) − <var>z</var>.</p>
- <pre>expression = SimpleExpression [relation SimpleExpression].
+ <p>If the designated object is a variable, then the designator refers to the variable's current value. If the object is a procedure, a designator without parameter list refers to that procedure. If it is followed by a (possibly empty) parameter list, the designator implies an activation of the procedure and stands for the value resulting from its execution. The (types of the) actual parameters must correspond to the formal parameters as specified in the procedure's declaration (see <a href="https://miasap.se/obnc/oberon-report.html#sec10">Ch. 10</a>).</p>
+
+ <p>Examples of designators (see examples in <a href="https://miasap.se/obnc/oberon-report.html#sec7">Ch. 7</a>):</p>
+
+ <div class="table">
+ <table>
+ <tbody><tr>
+ <td class="first">i</td>
+ <td class="last">(INTEGER)</td>
+ </tr>
+ <tr>
+ <td class="first">a[i]</td>
+ <td class="last">(REAL)</td>
+ </tr>
+ <tr>
+ <td class="first">w[3].ch</td>
+ <td class="last">(CHAR)</td>
+ </tr>
+ <tr>
+ <td class="first">t.key</td>
+ <td class="last">(INTEGER)</td>
+ </tr>
+ <tr>
+ <td class="first">t.left.right</td>
+ <td class="last">(Tree)</td>
+ </tr>
+ <tr>
+ <td class="first">t(CenterNode).subnode</td>
+ <td class="last">(Tree)</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <h3><a name="sec8.2">8.2. Operators</a></h3>
+
+ <p>The syntax of expressions distinguishes between four classes of operators with different precedences (binding strengths). The operator ~ has the highest precedence, followed by multiplication operators, addition operators, and relations. Operators of the same precedence associate from left to right. For example, <var>x</var> − <var>y</var> − <var>z</var> stands for (<var>x</var> − <var>y</var>) − <var>z</var>.</p>
+ <pre>expression = SimpleExpression [relation SimpleExpression].
relation = "=" | "#" | "<" | "<=" | ">" | ">=" | IN | IS.
SimpleExpression = ["+"|"-"] term {AddOperator term}.
AddOperator = "+" | "-" | OR.
term = factor {MulOperator factor}.
MulOperator = "*" | "/" | DIV | MOD | "&" .
factor = number | string | NIL | TRUE | FALSE |
- set | designator [ActualParameters] | "(" expression ")" | "~" factor.
+ set | designator [ActualParameters] | "(" expression ")" | "~" factor.
set = "{" [element {"," element}] "}".
element = expression [".." expression].
ActualParameters = "(" [ExpList] ")" .
</pre>
- <p>The set {<var>m</var> .. <var>n</var>} denotes {<var>m</var>, <var>m</var>+1, … , <var>n</var>-1, <var>n</var>}, and if <var>m</var> > <var>n</var>, the empty set. The available operators are listed in the following tables. In some instances, several different operations are designated by the same operator symbol. In these cases, the actual operation is identified by the type of the operands.</p>
-
- <h4><a name="sec8.2.1">8.2.1. Logical operators</a></h4>
-
- <div class="table">
- <table class="header">
- <tbody><tr>
- <th class="first">symbol</th>
- <th class="last">result</th>
- </tr>
- <tr class="second">
- <td class="first">OR</td>
- <td class="last">logical disjunction</td>
- </tr>
- <tr>
- <td class="first">&</td>
- <td class="last">logical conjunction</td>
- </tr>
- <tr>
- <td class="first">~</td>
- <td class="last">negation</td>
- </tr>
- </tbody></table>
- </div>
-
- <p>These operators apply to BOOLEAN operands and yield a BOOLEAN result.</p>
-
- <div class="table">
- <table>
- <tbody><tr>
- <td class="first"><var>p</var> OR <var>q</var></td>
- <td>stands for</td>
- <td class="last">“if <var>p</var> then TRUE, else <var>q</var>”</td>
- </tr>
- <tr>
- <td class="first"><var>p</var> & <var>q</var></td>
- <td>stands for</td>
- <td class="last">“if <var>p</var> then <var>q</var>, else FALSE”</td>
- </tr>
- <tr>
- <td class="first">~ <var>p</var></td>
- <td>stands for</td>
- <td class="last">“not <var>p</var>”</td>
- </tr>
- </tbody></table>
- </div>
-
- <h4><a name="sec8.2.2">8.2.2. Arithmetic operators</a></h4>
-
- <div class="table">
- <table class="header">
- <tbody><tr>
- <th class="first">symbol</th>
- <th class="last">result</th>
- </tr>
- <tr class="second">
- <td class="first">+</td>
- <td class="last">sum</td>
- </tr>
- <tr>
- <td class="first">−</td>
- <td class="last">difference</td>
- </tr>
- <tr>
- <td class="first">*</td>
- <td class="last">product</td>
- </tr>
- <tr>
- <td class="first">/</td>
- <td class="last">quotient</td>
- </tr>
- <tr>
- <td class="first">DIV</td>
- <td class="last">integer quotient</td>
- </tr>
- <tr>
- <td class="first">MOD</td>
- <td class="last">modulus</td>
- </tr>
- </tbody></table>
- </div>
-
- <p>The operators +, −, *, and / apply to operands of numeric types. Both operands must be of the same type, which is also the type of the result. When used as unary operators, − denotes sign inversion and + denotes the identity operation.</p>
-
- <p>The operators DIV and MOD apply to integer operands only. Let <var>q</var> = <var>x</var> DIV <var>y</var>, and <var>r</var> = <var>x</var> MOD <var>y</var>. Then quotient <var>q</var> and remainder <var>r</var> are defined by the equation</p>
-
- <pre><var>x</var> = <var>q</var>*<var>y</var> + <var>r</var> 0 <= <var>r</var> < <var>y</var>
-</pre>
-
- <h4><a name="sec8.2.3">8.2.3. Set operators</a></h4>
-
- <div class="table">
- <table class="header">
- <tbody><tr>
- <th class="first">symbol</th>
- <th class="last">result</th>
- </tr>
- <tr class="second">
- <td class="first">+</td>
- <td class="last">union</td>
- </tr>
- <tr>
- <td class="first">−</td>
- <td class="last">difference</td>
- </tr>
- <tr>
- <td class="first">*</td>
- <td class="last">intersection</td>
- </tr>
- <tr>
- <td class="first">/</td>
- <td class="last"> symmetric set difference</td>
- </tr>
- </tbody></table>
- </div>
-
- <p>When used with a single operand of type SET, the minus sign denotes the set complement.</p>
-
- <h4><a name="sec8.2.4">8.2.4. Relations</a></h4>
-
- <div class="table">
- <table class="header">
- <tbody><tr>
- <th class="first">symbol</th>
- <th class="last">relation</th>
- </tr>
- <tr class="second">
- <td class="first">=</td>
- <td class="last">equal</td>
- </tr>
- <tr>
- <td class="first">#</td>
- <td class="last">unequal</td>
- </tr>
- <tr>
- <td class="first"><</td>
- <td class="last">less</td>
- </tr>
- <tr>
- <td class="first"><=</td>
- <td class="last">less or equal</td>
- </tr>
- <tr>
- <td class="first">></td>
- <td class="last">greater</td>
- </tr>
- <tr>
- <td class="first">>=</td>
- <td class="last">greater or equal</td>
- </tr>
- <tr>
- <td class="first">IN</td>
- <td class="last">set membership</td>
- </tr>
- <tr>
- <td class="first">IS</td>
- <td class="last">type test</td>
- </tr>
- </tbody></table>
- </div>
-
- <p>Relations are Boolean. The ordering relations <, <=, >, >= apply to the numeric types, CHAR, and character arrays. The relations = and # also apply to the types BOOLEAN, SET, and to pointer and procedure types.</p>
-
- <p><var>x</var> IN <var>s</var> stands for “<var>x</var> is an element of <var>s</var>”. <var>x</var> must be of type INTEGER, and <var>s</var> of type SET.</p>
-
- <p><var>v</var> IS <var>T</var> stands for “<var>v</var> is of type <var>T</var>” and is called a <dfn>type test</dfn>. It is applicable, if</p>
-
- <ol>
- <li><var>T</var> is an extension of the declared type <var>T0</var> of <var>v</var>, and if</li>
- <li><var>v</var> is a variable parameter of record type or <var>v</var> is a pointer.</li>
- </ol>
-
- <p>Assuming, for instance, that <var>T</var> is an extension of <var>T0</var> and that <var>v</var> is a designator declared of type <var>T0</var>, then the test <var>v</var> IS <var>T</var> determines whether the actually designated variable is (not only a <var>T0</var>, but also) a <var>T</var>. The value of NIL IS <var>T</var> is undefined.</p>
-
- <p>Examples of expressions (refer to examples in <a href="https://miasap.se/obnc/oberon-report.html#sec7">Ch. 7</a>):</p>
-
- <div class="table">
- <table>
- <tbody><tr>
- <td class="first">1987</td>
- <td class="last">(INTEGER)</td>
- </tr>
- <tr>
- <td class="first">i DIV 3</td>
- <td class="last">(INTEGER)</td>
- </tr>
- <tr>
- <td class="first">~p OR q</td>
- <td class="last">(BOOLEAN)</td>
- </tr>
- <tr>
- <td class="first">(i+j) * (i-j)</td>
- <td class="last">(INTEGER)</td>
- </tr>
- <tr>
- <td class="first">s - {8, 9, 13}</td>
- <td class="last">(SET)</td>
- </tr>
- <tr>
- <td class="first">a[i+j] * a[i-j]</td>
- <td class="last">(REAL)</td>
- </tr>
- <tr>
- <td class="first">(0<=i) & (i<100)</td>
- <td class="last">(BOOLEAN)</td>
- </tr>
- <tr>
- <td class="first">t.key = 0</td>
- <td class="last">(BOOLEAN)</td>
- </tr>
- <tr>
- <td class="first">k IN {i .. j-1}</td>
- <td class="last">(BOOLEAN)</td>
- </tr>
- <tr>
- <td class="first">t IS CenterNode</td>
- <td class="last">(BOOLEAN)</td>
- </tr>
- </tbody></table>
- </div>
+ <p>The set {<var>m</var> .. <var>n</var>} denotes {<var>m</var>, <var>m</var>+1, … , <var>n</var>-1, <var>n</var>}, and if <var>m</var> > <var>n</var>, the empty set. The available operators are listed in the following tables. In some instances, several different operations are designated by the same operator symbol. In these cases, the actual operation is identified by the type of the operands.</p>
+
+ <h4><a name="sec8.2.1">8.2.1. Logical operators</a></h4>
+
+ <div class="table">
+ <table class="header">
+ <tbody><tr>
+ <th class="first">symbol</th>
+ <th class="last">result</th>
+ </tr>
+ <tr class="second">
+ <td class="first">OR</td>
+ <td class="last">logical disjunction</td>
+ </tr>
+ <tr>
+ <td class="first">&</td>
+ <td class="last">logical conjunction</td>
+ </tr>
+ <tr>
+ <td class="first">~</td>
+ <td class="last">negation</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p>These operators apply to BOOLEAN operands and yield a BOOLEAN result.</p>
+
+ <div class="table">
+ <table>
+ <tbody><tr>
+ <td class="first"><var>p</var> OR <var>q</var></td>
+ <td>stands for</td>
+ <td class="last">“if <var>p</var> then TRUE, else <var>q</var>”</td>
+ </tr>
+ <tr>
+ <td class="first"><var>p</var> & <var>q</var></td>
+ <td>stands for</td>
+ <td class="last">“if <var>p</var> then <var>q</var>, else FALSE”</td>
+ </tr>
+ <tr>
+ <td class="first">~ <var>p</var></td>
+ <td>stands for</td>
+ <td class="last">“not <var>p</var>”</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <h4><a name="sec8.2.2">8.2.2. Arithmetic operators</a></h4>
+
+ <div class="table">
+ <table class="header">
+ <tbody><tr>
+ <th class="first">symbol</th>
+ <th class="last">result</th>
+ </tr>
+ <tr class="second">
+ <td class="first">+</td>
+ <td class="last">sum</td>
+ </tr>
+ <tr>
+ <td class="first">−</td>
+ <td class="last">difference</td>
+ </tr>
+ <tr>
+ <td class="first">*</td>
+ <td class="last">product</td>
+ </tr>
+ <tr>
+ <td class="first">/</td>
+ <td class="last">quotient</td>
+ </tr>
+ <tr>
+ <td class="first">DIV</td>
+ <td class="last">integer quotient</td>
+ </tr>
+ <tr>
+ <td class="first">MOD</td>
+ <td class="last">modulus</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p>The operators +, −, *, and / apply to operands of numeric types. Both operands must be of the same type, which is also the type of the result. When used as unary operators, − denotes sign inversion and + denotes the identity operation.</p>
+
+ <p>The operators DIV and MOD apply to integer operands only. Let <var>q</var> = <var>x</var> DIV <var>y</var>, and <var>r</var> = <var>x</var> MOD <var>y</var>. Then quotient <var>q</var> and remainder <var>r</var> are defined by the equation</p>
+
+ <pre><var>x</var> = <var>q</var>*<var>y</var> + <var>r</var> 0 <= <var>r</var> < <var>y</var>
+</pre>
+
+ <h4><a name="sec8.2.3">8.2.3. Set operators</a></h4>
+
+ <div class="table">
+ <table class="header">
+ <tbody><tr>
+ <th class="first">symbol</th>
+ <th class="last">result</th>
+ </tr>
+ <tr class="second">
+ <td class="first">+</td>
+ <td class="last">union</td>
+ </tr>
+ <tr>
+ <td class="first">−</td>
+ <td class="last">difference</td>
+ </tr>
+ <tr>
+ <td class="first">*</td>
+ <td class="last">intersection</td>
+ </tr>
+ <tr>
+ <td class="first">/</td>
+ <td class="last"> symmetric set difference</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p>When used with a single operand of type SET, the minus sign denotes the set complement.</p>
+
+ <h4><a name="sec8.2.4">8.2.4. Relations</a></h4>
+
+ <div class="table">
+ <table class="header">
+ <tbody><tr>
+ <th class="first">symbol</th>
+ <th class="last">relation</th>
+ </tr>
+ <tr class="second">
+ <td class="first">=</td>
+ <td class="last">equal</td>
+ </tr>
+ <tr>
+ <td class="first">#</td>
+ <td class="last">unequal</td>
+ </tr>
+ <tr>
+ <td class="first"><</td>
+ <td class="last">less</td>
+ </tr>
+ <tr>
+ <td class="first"><=</td>
+ <td class="last">less or equal</td>
+ </tr>
+ <tr>
+ <td class="first">></td>
+ <td class="last">greater</td>
+ </tr>
+ <tr>
+ <td class="first">>=</td>
+ <td class="last">greater or equal</td>
+ </tr>
+ <tr>
+ <td class="first">IN</td>
+ <td class="last">set membership</td>
+ </tr>
+ <tr>
+ <td class="first">IS</td>
+ <td class="last">type test</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p>Relations are Boolean. The ordering relations <, <=, >, >= apply to the numeric types, CHAR, and character arrays. The relations = and # also apply to the types BOOLEAN, SET, and to pointer and procedure types.</p>
+
+ <p><var>x</var> IN <var>s</var> stands for “<var>x</var> is an element of <var>s</var>”. <var>x</var> must be of type INTEGER, and <var>s</var> of type SET.</p>
+
+ <p><var>v</var> IS <var>T</var> stands for “<var>v</var> is of type <var>T</var>” and is called a <dfn>type test</dfn>. It is applicable, if</p>
+
+ <ol>
+ <li><var>T</var> is an extension of the declared type <var>T0</var> of <var>v</var>, and if</li>
+ <li><var>v</var> is a variable parameter of record type or <var>v</var> is a pointer.</li>
+ </ol>
+
+ <p>Assuming, for instance, that <var>T</var> is an extension of <var>T0</var> and that <var>v</var> is a designator declared of type <var>T0</var>, then the test <var>v</var> IS <var>T</var> determines whether the actually designated variable is (not only a <var>T0</var>, but also) a <var>T</var>. The value of NIL IS <var>T</var> is undefined.</p>
+
+ <p>Examples of expressions (refer to examples in <a href="https://miasap.se/obnc/oberon-report.html#sec7">Ch. 7</a>):</p>
+
+ <div class="table">
+ <table>
+ <tbody><tr>
+ <td class="first">1987</td>
+ <td class="last">(INTEGER)</td>
+ </tr>
+ <tr>
+ <td class="first">i DIV 3</td>
+ <td class="last">(INTEGER)</td>
+ </tr>
+ <tr>
+ <td class="first">~p OR q</td>
+ <td class="last">(BOOLEAN)</td>
+ </tr>
+ <tr>
+ <td class="first">(i+j) * (i-j)</td>
+ <td class="last">(INTEGER)</td>
+ </tr>
+ <tr>
+ <td class="first">s - {8, 9, 13}</td>
+ <td class="last">(SET)</td>
+ </tr>
+ <tr>
+ <td class="first">a[i+j] * a[i-j]</td>
+ <td class="last">(REAL)</td>
+ </tr>
+ <tr>
+ <td class="first">(0<=i) & (i<100)</td>
+ <td class="last">(BOOLEAN)</td>
+ </tr>
+ <tr>
+ <td class="first">t.key = 0</td>
+ <td class="last">(BOOLEAN)</td>
+ </tr>
+ <tr>
+ <td class="first">k IN {i .. j-1}</td>
+ <td class="last">(BOOLEAN)</td>
+ </tr>
+ <tr>
+ <td class="first">t IS CenterNode</td>
+ <td class="last">(BOOLEAN)</td>
+ </tr>
+ </tbody></table>
+ </div>
- <h2><a name="sec9">9. Statements</a></h2>
+ <h2><a name="sec9">9. Statements</a></h2>
- <p>Statements denote actions. There are elementary and structured statements. Elementary statements are not composed of any parts that are themselves statements. They are the assignment and the procedure call. Structured statements are composed of parts that are themselves statements. They are used to express sequencing and conditional, selective, and repetitive execution. A statement may also be empty, in which case it denotes no action. The empty statement is included in order to relax punctuation rules in statement sequences.</p>
+ <p>Statements denote actions. There are elementary and structured statements. Elementary statements are not composed of any parts that are themselves statements. They are the assignment and the procedure call. Structured statements are composed of parts that are themselves statements. They are used to express sequencing and conditional, selective, and repetitive execution. A statement may also be empty, in which case it denotes no action. The empty statement is included in order to relax punctuation rules in statement sequences.</p>
- <pre>statement = [assignment | ProcedureCall | IfStatement | CaseStatement |
- WhileStatement | RepeatStatement | ForStatement].
+ <pre>statement = [assignment | ProcedureCall | IfStatement | CaseStatement |
+ WhileStatement | RepeatStatement | ForStatement].
</pre>
- <h3><a name="sec9.1">9.1. Assignments</a></h3>
+ <h3><a name="sec9.1">9.1. Assignments</a></h3>
- <p>The assignment serves to replace the current value of a variable by a new value specified by an expression. The assignment operator is written as “:=” and pronounced as <dfn>becomes</dfn>.</p>
+ <p>The assignment serves to replace the current value of a variable by a new value specified by an expression. The assignment operator is written as “:=” and pronounced as <dfn>becomes</dfn>.</p>
- <pre>assignment = designator ":=" expression.
+ <pre>assignment = designator ":=" expression.
</pre>
- <p>If a value parameter is structured (of array or record type), no assignment to it or to its elements are permitted. Neither may assignments be made to imported variables.</p>
+ <p>If a value parameter is structured (of array or record type), no assignment to it or to its elements are permitted. Neither may assignments be made to imported variables.</p>
- <p>The type of the expression must be the same as that of the designator. The following exceptions hold:</p>
+ <p>The type of the expression must be the same as that of the designator. The following exceptions hold:</p>
- <ol>
- <li>The constant NIL can be assigned to variables of any pointer or procedure type.</li>
- <li>Strings can be assigned to any array of characters, provided the number of characters in the string is less than that of the array. (A null character is appended). Single-character strings can also be assigned to variables of type CHAR.</li>
- <li>In the case of records, the type of the source must be an extension of the type of the destination.</li>
- <li>An open array may be assigned to an array of equal base type.</li>
- </ol>
+ <ol>
+ <li>The constant NIL can be assigned to variables of any pointer or procedure type.</li>
+ <li>Strings can be assigned to any array of characters, provided the number of characters in the string is less than that of the array. (A null character is appended). Single-character strings can also be assigned to variables of type CHAR.</li>
+ <li>In the case of records, the type of the source must be an extension of the type of the destination.</li>
+ <li>An open array may be assigned to an array of equal base type.</li>
+ </ol>
- <p>Examples of assignments (see examples in <a href="https://miasap.se/obnc/oberon-report.html#sec7">Ch. 7</a>):</p>
+ <p>Examples of assignments (see examples in <a href="https://miasap.se/obnc/oberon-report.html#sec7">Ch. 7</a>):</p>
- <pre>i := 0
+ <pre>i := 0
</pre>
- <pre>p := i = j
+ <pre>p := i = j
</pre>
- <pre>x := FLT(i + 1)
+ <pre>x := FLT(i + 1)
</pre>
- <pre>k := (i + j) DIV 2
+ <pre>k := (i + j) DIV 2
</pre>
- <pre>f := log2
+ <pre>f := log2
</pre>
- <pre>s := {2, 3, 5, 7, 11, 13}
+ <pre>s := {2, 3, 5, 7, 11, 13}
</pre>
- <pre>a[i] := (x+y) * (x-y)
+ <pre>a[i] := (x+y) * (x-y)
</pre>
- <pre>t.key := i
+ <pre>t.key := i
</pre>
- <pre>w[i+1].ch := "A"
+ <pre>w[i+1].ch := "A"
</pre>
- <h3><a name="sec9.2">9.2. Procedure calls</a></h3>
+ <h3><a name="sec9.2">9.2. Procedure calls</a></h3>
- <p>A procedure call serves to activate a procedure. The procedure call may contain a list of actual parameters which are substituted in place of their corresponding formal parameters defined in the procedure declaration (see <a href="https://miasap.se/obnc/oberon-report.html#sec10">Ch. 10</a>). The correspondence is established by the positions of the parameters in the lists of actual and formal parameters respectively. There exist two kinds of parameters: <dfn>variable</dfn> and <dfn>value</dfn> parameters.</p>
+ <p>A procedure call serves to activate a procedure. The procedure call may contain a list of actual parameters which are substituted in place of their corresponding formal parameters defined in the procedure declaration (see <a href="https://miasap.se/obnc/oberon-report.html#sec10">Ch. 10</a>). The correspondence is established by the positions of the parameters in the lists of actual and formal parameters respectively. There exist two kinds of parameters: <dfn>variable</dfn> and <dfn>value</dfn> parameters.</p>
- <p>In the case of variable parameters, the actual parameter must be a designator denoting a variable. If it designates an element of a structured variable, the selector is evaluated when the formal/actual parameter substitution takes place, i.e. before the execution of the procedure. If the parameter is a value parameter, the corresponding actual parameter must be an expression. This expression is evaluated prior to the procedure activation, and the resulting value is assigned to the formal parameter which now constitutes a local variable (see also <a href="https://miasap.se/obnc/oberon-report.html#sec10.1">10.1</a>.).</p>
+ <p>In the case of variable parameters, the actual parameter must be a designator denoting a variable. If it designates an element of a structured variable, the selector is evaluated when the formal/actual parameter substitution takes place, i.e. before the execution of the procedure. If the parameter is a value parameter, the corresponding actual parameter must be an expression. This expression is evaluated prior to the procedure activation, and the resulting value is assigned to the formal parameter which now constitutes a local variable (see also <a href="https://miasap.se/obnc/oberon-report.html#sec10.1">10.1</a>.).</p>
- <pre>ProcedureCall = designator [ActualParameters].
+ <pre>ProcedureCall = designator [ActualParameters].
</pre>
- <p>Examples of procedure calls:</p>
+ <p>Examples of procedure calls:</p>
- <div class="table">
- <table>
- <tbody><tr>
- <td class="first">ReadInt(i)</td>
- <td class="last">(see <a href="https://miasap.se/obnc/oberon-report.html#sec10">Ch. 10</a>)</td>
- </tr>
- <tr>
- <td class="first">WriteInt(2*j + 1, 6)</td>
- <td class="last"></td>
- </tr>
- <tr>
- <td class="first">INC(w[k].count)</td>
- <td class="last"></td>
- </tr>
- </tbody></table>
- </div>
+ <div class="table">
+ <table>
+ <tbody><tr>
+ <td class="first">ReadInt(i)</td>
+ <td class="last">(see <a href="https://miasap.se/obnc/oberon-report.html#sec10">Ch. 10</a>)</td>
+ </tr>
+ <tr>
+ <td class="first">WriteInt(2*j + 1, 6)</td>
+ <td class="last"></td>
+ </tr>
+ <tr>
+ <td class="first">INC(w[k].count)</td>
+ <td class="last"></td>
+ </tr>
+ </tbody></table>
+ </div>
- <h3><a name="sec9.3">9.3. Statement sequences</a></h3>
+ <h3><a name="sec9.3">9.3. Statement sequences</a></h3>
- <p>Statement sequences denote the sequence of actions specified by the component statements which are separated by semicolons.</p>
+ <p>Statement sequences denote the sequence of actions specified by the component statements which are separated by semicolons.</p>
- <pre>StatementSequence = statement {";" statement}.
+ <pre>StatementSequence = statement {";" statement}.
</pre>
- <h3><a name="sec9.4">9.4. If statements</a></h3>
+ <h3><a name="sec9.4">9.4. If statements</a></h3>
- <pre>IfStatement = IF expression THEN StatementSequence
- {ELSIF expression THEN StatementSequence}
- [ELSE StatementSequence]
- END.
+ <pre>IfStatement = IF expression THEN StatementSequence
+ {ELSIF expression THEN StatementSequence}
+ [ELSE StatementSequence]
+ END.
</pre>
- <p>If statements specify the conditional execution of guarded statements. The Boolean expression preceding a statement is called its <dfn>guard</dfn>. The guards are evaluated in sequence of occurrence, until one evaluates to TRUE, whereafter its associated statement sequence is executed. If no guard is satisfied, the statement sequence following the symbol ELSE is executed, if there is one.</p>
+ <p>If statements specify the conditional execution of guarded statements. The Boolean expression preceding a statement is called its <dfn>guard</dfn>. The guards are evaluated in sequence of occurrence, until one evaluates to TRUE, whereafter its associated statement sequence is executed. If no guard is satisfied, the statement sequence following the symbol ELSE is executed, if there is one.</p>
- <p>Example:</p>
+ <p>Example:</p>
- <pre>IF (ch >= "A") & (ch <= "Z") THEN ReadIdentifier
+ <pre>IF (ch >= "A") & (ch <= "Z") THEN ReadIdentifier
ELSIF (ch >= "0") & (ch <= "9") THEN ReadNumber
ELSIF ch = 22X THEN ReadString
END
</pre>
- <h3><a name="sec9.5">9.5. Case statements</a></h3>
+ <h3><a name="sec9.5">9.5. Case statements</a></h3>
- <p>Case statements specify the selection and execution of a statement sequence according to the value of an expression. First the case expression is evaluated, then the statement sequence is executed whose case label list contains the obtained value. If the case expression is of type INTEGER or CHAR, all labels must be integers or single-character strings, respectively.</p>
+ <p>Case statements specify the selection and execution of a statement sequence according to the value of an expression. First the case expression is evaluated, then the statement sequence is executed whose case label list contains the obtained value. If the case expression is of type INTEGER or CHAR, all labels must be integers or single-character strings, respectively.</p>
- <pre>CaseStatement = CASE expression OF case {"|" case} END.
+ <pre>CaseStatement = CASE expression OF case {"|" case} END.
case = [CaseLabelList ":" StatementSequence].
CaseLabelList = LabelRange {"," LabelRange}.
LabelRange = label [".." label].
label = integer | string | qualident.
</pre>
- <p>Example:</p>
+ <p>Example:</p>
- <pre>CASE k OF
- 0: x := x + y
- | 1: x := x − y
- | 2: x := x * y
- | 3: x := x / y
+ <pre>CASE k OF
+ 0: x := x + y
+ | 1: x := x − y
+ | 2: x := x * y
+ | 3: x := x / y
END
</pre>
- <p>The type <var>T</var> of the case expression (case variable) may also be a record or pointer type. Then the
+ <p>The type <var>T</var> of the case expression (case variable) may also be a record or pointer type. Then the
case labels must be extensions of <var>T</var>, and in the statements <var>Si</var> labelled by <var>Ti</var>, the case variable is considered as of type <var>Ti</var>.</p>
- <p>Example:</p>
+ <p>Example:</p>
- <pre>TYPE R = RECORD a: INTEGER END;
- R0 = RECORD (R) b: INTEGER END;
- R1 = RECORD (R) b: REAL END;
- R2 = RECORD (R) b: SET END;
- P = POINTER TO R;
- P0 = POINTER TO R0;
- P1 = POINTER TO R1;
- P2 = POINTER TO R2;
+ <pre>TYPE R = RECORD a: INTEGER END;
+ R0 = RECORD (R) b: INTEGER END;
+ R1 = RECORD (R) b: REAL END;
+ R2 = RECORD (R) b: SET END;
+ P = POINTER TO R;
+ P0 = POINTER TO R0;
+ P1 = POINTER TO R1;
+ P2 = POINTER TO R2;
VAR p: P;
</pre>
- <pre>CASE p OF
- P0: p.b := 10 |
- P1: p.b := 2.5 |
- P2: p.b := {0, 2}
+ <pre>CASE p OF
+ P0: p.b := 10 |
+ P1: p.b := 2.5 |
+ P2: p.b := {0, 2}
END
</pre>
- <h3><a name="sec9.6">9.6. While statements</a></h3>
+ <h3><a name="sec9.6">9.6. While statements</a></h3>
- <p>While statements specify repetition. If any of the Boolean expressions (guards) yields TRUE, the corresponding statement sequence is executed. The expression evaluation and the statement execution are repeated until none of the Boolean expressions yields TRUE.</p>
+ <p>While statements specify repetition. If any of the Boolean expressions (guards) yields TRUE, the corresponding statement sequence is executed. The expression evaluation and the statement execution are repeated until none of the Boolean expressions yields TRUE.</p>
- <pre>WhileStatement = WHILE expression DO StatementSequence
- {ELSIF expression DO StatementSequence} END.
+ <pre>WhileStatement = WHILE expression DO StatementSequence
+ {ELSIF expression DO StatementSequence} END.
</pre>
- <p>Examples:</p>
+ <p>Examples:</p>
- <pre>WHILE j > 0 DO
- j := j DIV 2; i := i+1
+ <pre>WHILE j > 0 DO
+ j := j DIV 2; i := i+1
END
</pre>
- <pre>WHILE (t # NIL) & (t.key # i) DO
- t := t.left
+ <pre>WHILE (t # NIL) & (t.key # i) DO
+ t := t.left
END
</pre>
- <pre>WHILE m > n DO m := m - n
+ <pre>WHILE m > n DO m := m - n
ELSIF n > m DO n := n - m
END
</pre>
- <h3><a name="sec9.7">9.7. Repeat Statements</a></h3>
+ <h3><a name="sec9.7">9.7. Repeat Statements</a></h3>
- <p>A repeat statement specifies the repeated execution of a statement sequence until a condition is satisfied. The statement sequence is executed at least once.</p>
+ <p>A repeat statement specifies the repeated execution of a statement sequence until a condition is satisfied. The statement sequence is executed at least once.</p>
- <pre>RepeatStatement = REPEAT StatementSequence UNTIL expression.
+ <pre>RepeatStatement = REPEAT StatementSequence UNTIL expression.
</pre>
- <h3><a name="sec9.8">9.8. For statements</a></h3>
+ <h3><a name="sec9.8">9.8. For statements</a></h3>
- <p>A for statement specifies the repeated execution of a statement sequence for a given number of times, while a progression of values is assigned to an integer variable called the <dfn>control variable</dfn> of the for statement.</p>
+ <p>A for statement specifies the repeated execution of a statement sequence for a given number of times, while a progression of values is assigned to an integer variable called the <dfn>control variable</dfn> of the for statement.</p>
- <pre>ForStatement =
- FOR ident ":=" expression TO expression [BY ConstExpression] DO
- StatementSequence END.
+ <pre>ForStatement =
+ FOR ident ":=" expression TO expression [BY ConstExpression] DO
+ StatementSequence END.
</pre>
- <p>The for statement</p>
+ <p>The for statement</p>
- <pre>FOR v := beg TO end BY inc DO S END
+ <pre>FOR v := beg TO end BY inc DO S END
</pre>
- <p>is, if <var>inc</var> > 0, equivalent to</p>
+ <p>is, if <var>inc</var> > 0, equivalent to</p>
- <pre>v := beg;
+ <pre>v := beg;
WHILE v <= end DO S; v := v + inc END
</pre>
- <p>and if <var>inc</var> < 0 it is equivalent to</p>
+ <p>and if <var>inc</var> < 0 it is equivalent to</p>
- <pre>v := beg;
+ <pre>v := beg;
WHILE v >= end DO S; v := v + inc END
</pre>
- <p>The types of <var>v</var>, <var>beg</var> and <var>end</var> must be INTEGER, and <var>inc</var> must be an integer (constant expression). If the step is not specified, it is assumed to be 1.</p>
+ <p>The types of <var>v</var>, <var>beg</var> and <var>end</var> must be INTEGER, and <var>inc</var> must be an integer (constant expression). If the step is not specified, it is assumed to be 1.</p>
- <h2><a name="sec10">10. Procedure declarations</a></h2>
+ <h2><a name="sec10">10. Procedure declarations</a></h2>
- <p>Procedure declarations consist of a procedure heading and a procedure body. The heading specifies the procedure identifier, the formal parameters, and the result type (if any). The body contains declarations and statements. The procedure identifier is repeated at the end of the procedure declaration.</p>
+ <p>Procedure declarations consist of a procedure heading and a procedure body. The heading specifies the procedure identifier, the formal parameters, and the result type (if any). The body contains declarations and statements. The procedure identifier is repeated at the end of the procedure declaration.</p>
- <p>There are two kinds of procedures, namely proper procedures and function procedures. The latter are activated by a function designator as a constituent of an expression, and yield a result that is an operand in the expression. Proper procedures
+ <p>There are two kinds of procedures, namely proper procedures and function procedures. The latter are activated by a function designator as a constituent of an expression, and yield a result that is an operand in the expression. Proper procedures
are activated by a procedure call. A function procedure is distinguished in the declaration by indication of the type of its result following the parameter list. Its body must end with a RETURN clause which defines the result of the function procedure.</p>
- <p>All constants, variables, types, and procedures declared within a procedure body are local to the procedure. The values of local variables are undefined upon entry to the procedure. Since procedures may be declared as local objects too, procedure declarations may be nested.</p>
+ <p>All constants, variables, types, and procedures declared within a procedure body are local to the procedure. The values of local variables are undefined upon entry to the procedure. Since procedures may be declared as local objects too, procedure declarations may be nested.</p>
- <p>In addition to its formal parameters and locally declared objects, the objects declared globally are also visible in the procedure.</p>
+ <p>In addition to its formal parameters and locally declared objects, the objects declared globally are also visible in the procedure.</p>
- <p>The use of the procedure identifier in a call within its declaration implies recursive activation of the procedure.</p>
+ <p>The use of the procedure identifier in a call within its declaration implies recursive activation of the procedure.</p>
- <pre>ProcedureDeclaration = ProcedureHeading ";" ProcedureBody ident.
+ <pre>ProcedureDeclaration = ProcedureHeading ";" ProcedureBody ident.
ProcedureHeading = PROCEDURE identdef [FormalParameters].
ProcedureBody = DeclarationSequence [BEGIN StatementSequence]
- [RETURN expression] END.
+ [RETURN expression] END.
DeclarationSequence = [CONST {ConstDeclaration ";"}]
- [TYPE {TypeDeclaration ";"}] [VAR {VariableDeclaration ";"}]
- {ProcedureDeclaration ";"}.
+ [TYPE {TypeDeclaration ";"}] [VAR {VariableDeclaration ";"}]
+ {ProcedureDeclaration ";"}.
</pre>
- <h3><a name="sec10.1">10.1. Formal parameters</a></h3>
+ <h3><a name="sec10.1">10.1. Formal parameters</a></h3>
- <p>Formal parameters are identifiers which denote actual parameters specified in the procedure call. The correspondence between formal and actual parameters is established when the procedure is called. There are two kinds of parameters, namely
+ <p>Formal parameters are identifiers which denote actual parameters specified in the procedure call. The correspondence between formal and actual parameters is established when the procedure is called. There are two kinds of parameters, namely
<dfn>value</dfn> and <dfn>variable</dfn> parameters. A variable parameter corresponds to an actual parameter that is a variable, and it stands for that variable. A value parameter corresponds to an actual parameter that is an expression, and it stands for its value, which cannot be changed by assignment. However, if a value parameter is of a basic type, it represents a local variable to which the value of the actual expression is initially assigned.</p>
- <p>The kind of a parameter is indicated in the formal parameter list: Variable parameters are denoted by the symbol VAR and value parameters by the absence of a prefix.</p>
+ <p>The kind of a parameter is indicated in the formal parameter list: Variable parameters are denoted by the symbol VAR and value parameters by the absence of a prefix.</p>
- <p>A function procedure without parameters must have an empty parameter list. It must be called by a function designator whose actual parameter list is empty too.</p>
+ <p>A function procedure without parameters must have an empty parameter list. It must be called by a function designator whose actual parameter list is empty too.</p>
- <p>Formal parameters are local to the procedure, i.e. their scope is the program text which constitutes the procedure declaration.</p>
+ <p>Formal parameters are local to the procedure, i.e. their scope is the program text which constitutes the procedure declaration.</p>
- <pre>FormalParameters = "(" [FPSection {";" FPSection}] ")" [":" qualident].
+ <pre>FormalParameters = "(" [FPSection {";" FPSection}] ")" [":" qualident].
FPSection = [VAR] ident {"," ident} ":" FormalType.
FormalType = {ARRAY OF} qualident.
</pre>
- <p>The type of each formal parameter is specified in the parameter list. For variable parameters, it must be identical to the corresponding actual parameter's type, except in the case of a record, where it must be a base type of the corresponding actual parameter's type.</p>
+ <p>The type of each formal parameter is specified in the parameter list. For variable parameters, it must be identical to the corresponding actual parameter's type, except in the case of a record, where it must be a base type of the corresponding actual parameter's type.</p>
- <p>If the formal parameter's type is specified as</p>
+ <p>If the formal parameter's type is specified as</p>
- <pre>ARRAY OF T
+ <pre>ARRAY OF T
</pre>
- <p>the parameter is said to be an <dfn>open array</dfn>, and the corresponding actual parameter may be of arbitrary length.</p>
+ <p>the parameter is said to be an <dfn>open array</dfn>, and the corresponding actual parameter may be of arbitrary length.</p>
- <p>If a formal parameter specifies a procedure type, then the corresponding actual parameter must be either a procedure declared globally, or a variable (or parameter) of that procedure type. It cannot be a predefined procedure. The result type of a procedure can be neither a record nor an array.</p>
+ <p>If a formal parameter specifies a procedure type, then the corresponding actual parameter must be either a procedure declared globally, or a variable (or parameter) of that procedure type. It cannot be a predefined procedure. The result type of a procedure can be neither a record nor an array.</p>
- <p>Examples of procedure declarations:</p>
+ <p>Examples of procedure declarations:</p>
- <pre>PROCEDURE ReadInt(VAR x: INTEGER);
- VAR i: INTEGER; ch: CHAR;
+ <pre>PROCEDURE ReadInt(VAR x: INTEGER);
+ VAR i: INTEGER; ch: CHAR;
BEGIN i := 0; Read(ch);
- WHILE ("0" <= ch) & (ch <= "9") DO
- i := 10*i + (ORD(ch) - ORD("0")); Read(ch)
- END;
- x := i
+ WHILE ("0" <= ch) & (ch <= "9") DO
+ i := 10*i + (ORD(ch) - ORD("0")); Read(ch)
+ END;
+ x := i
END ReadInt
</pre>
- <pre>PROCEDURE WriteInt(x: INTEGER); (* 0 <= x < 10^5 *)
- VAR i: INTEGER;
- buf: ARRAY 5 OF INTEGER;
+ <pre>PROCEDURE WriteInt(x: INTEGER); (* 0 <= x < 10^5 *)
+ VAR i: INTEGER;
+ buf: ARRAY 5 OF INTEGER;
BEGIN i := 0;
- REPEAT buf[i] := x MOD 10; x := x DIV 10; INC(i) UNTIL x = 0;
- REPEAT DEC(i); Write(CHR(buf[i] + ORD("0"))) UNTIL i = 0
+ REPEAT buf[i] := x MOD 10; x := x DIV 10; INC(i) UNTIL x = 0;
+ REPEAT DEC(i); Write(CHR(buf[i] + ORD("0"))) UNTIL i = 0
END WriteInt
</pre>
- <pre>PROCEDURE log2(x: INTEGER): INTEGER;
- VAR y: INTEGER; (*assume x>0*)
+ <pre>PROCEDURE log2(x: INTEGER): INTEGER;
+ VAR y: INTEGER; (*assume x>0*)
BEGIN y := 0;
- WHILE x > 1 DO x := x DIV 2; INC(y) END;
- RETURN y
+ WHILE x > 1 DO x := x DIV 2; INC(y) END;
+ RETURN y
END log2
</pre>
- <h3><a name="sec10.2">10.2. Predefined procedures</a></h3>
-
- <p>The following table lists the predefined procedures. Some are generic procedures, i.e. they apply to several types of operands. v stands for a variable, x and n for expressions, and T for a type.</p>
-
- <p><em>Function procedures</em>:</p>
-
- <div class="table">
- <table class="header">
- <tbody><tr>
- <th class="first">Name</th>
- <th>Argument type</th>
- <th>Result type</th>
- <th class="last">Function</th>
- </tr>
- <tr class="second">
- <td class="first">ABS(x)</td>
- <td>x: numeric type</td>
- <td>type of x</td>
- <td class="last">absolute value</td>
- </tr>
- <tr>
- <td class="first">ODD(x)</td>
- <td>x: INTEGER</td>
- <td>BOOLEAN</td>
- <td class="last">x MOD 2 = 1</td>
- </tr>
- <tr>
- <td class="first">LEN(v)</td>
- <td> v: array</td>
- <td>INTEGER</td>
- <td class="last">the length of v</td>
- </tr>
- <tr>
- <td class="first">LSL(x, n)</td>
- <td>x, n: INTEGER</td>
- <td>INTEGER</td>
- <td class="last">logical shift left, x * 2<sup>n</sup></td>
- </tr>
- <tr>
- <td class="first">ASR(x, n)</td>
- <td>x, n: INTEGER</td>
- <td>INTEGER</td>
- <td class="last">signed shift right, x DIV 2<sup>n</sup></td>
- </tr>
- <tr>
- <td class="first">ROR(x, n)</td>
- <td>x, n: INTEGER</td>
- <td>INTEGER</td>
- <td class="last">x rotated right by n bits</td>
- </tr>
- </tbody></table>
- </div>
-
- <p><em>Type conversion functions</em>:</p>
-
- <div class="table">
- <table class="header">
- <tbody><tr>
- <th class="first">Name</th>
- <th>Argument type</th>
- <th>Result type</th>
- <th class="last">Function</th>
- </tr>
- <tr class="second">
- <td class="first">Floor(x)</td>
- <td>Real</td>
- <td>Int</td>
- <td class="last">truncation</td>
- </tr>
- <tr>
- <td class="first">AsReal(x)</td>
- <td>Int</td>
- <td>Real</td>
- <td class="last">identity</td>
- </tr>
- <tr>
- <td class="first">AsInt(x)</td>
- <td>Char, Bool, Set</td>
- <td>Int</td>
- <td class="last">ordinal number of x</td>
- </tr>
- <tr>
- <td class="first">AsChar(x)</td>
- <td>Int</td>
- <td>Char</td>
- <td style="white-space: normal">character with ordinal number x</td>
- </tr>
- </tbody></table>
- </div>
-
- <p><em>Proper procedures</em>:</p>
-
- <div class="table">
- <table class="header">
- <tbody><tr>
- <th class="first">Name</th>
- <th>Argument types</th>
- <th class="last">Function</th>
- </tr>
- <tr class="group-first second">
- <td class="first">Increment(v)</td>
- <td>Integer</td>
- <td class="last">v := v + 1</td>
- </tr>
- <tr>
- <td class="first">Increment(v, n)</td>
- <td>Int</td>
- <td class="last">v := v + n</td>
- </tr>
- <tr class="group-first">
- <td class="first">Decrement(v)</td>
- <td>Int</td>
- <td class="last">v := v - 1</td>
- </tr>
- <tr>
- <td class="first">Decrement(v, n)</td>
- <td>Int</td>
- <td class="last">v := v - n</td>
- </tr>
- <tr class="group-first">
- <td class="first">Include(v, x)</td>
- <td>v: Set; x: Int</td>
- <td class="last">v := v + {x}</td>
- </tr>
- <tr>
- <td class="first">Exclude(v, x)</td>
- <td>v: Set; x: Int</td>
- <td class="last">v := v - {x}</td>
- </tr>
- <tr class="group-first">
- <td class="first">New(v)</td>
- <td>pointer type</td>
- <td class="last">allocate v^</td>
- </tr>
- <tr class="group-first">
- <td class="first">Assert(b)</td>
- <td>Bool</td>
- <td class="last">abort, if ~b</td>
- </tr>
- </tbody></table>
- </div>
-
- <p>The function Floor(<var>x</var>) yields the largest integer not greater than <var>x</var>.</p>
-
- <pre>Floor(1.5) = 1 Floor(-1.5) = -2
-</pre>
-
- <h2><a name="sec11">11. Modules</a></h2>
-
- <p>A module is a collection of declarations of constants, types, variables, and procedures, and a sequence of statements for the purpose of assigning initial values to the variables. A module typically constitutes a text that is compilable as a unit.</p>
-
- <pre>module = MODULE ident ";" [ImportList] DeclarationSequence
- [BEGIN StatementSequence] END ident "." .
+ <h3><a name="sec10.2">10.2. Predefined procedures</a></h3>
+
+ <p>The following table lists the predefined procedures. Some are generic procedures, i.e. they apply to several types of operands. v stands for a variable, x and n for expressions, and T for a type.</p>
+
+ <p><em>Function procedures</em>:</p>
+
+ <div class="table">
+ <table class="header">
+ <tbody><tr>
+ <th class="first">Name</th>
+ <th>Argument type</th>
+ <th>Result type</th>
+ <th class="last">Function</th>
+ </tr>
+ <tr class="second">
+ <td class="first">ABS(x)</td>
+ <td>x: numeric type</td>
+ <td>type of x</td>
+ <td class="last">absolute value</td>
+ </tr>
+ <tr>
+ <td class="first">ODD(x)</td>
+ <td>x: INTEGER</td>
+ <td>BOOLEAN</td>
+ <td class="last">x MOD 2 = 1</td>
+ </tr>
+ <tr>
+ <td class="first">LEN(v)</td>
+ <td> v: array</td>
+ <td>INTEGER</td>
+ <td class="last">the length of v</td>
+ </tr>
+ <tr>
+ <td class="first">LSL(x, n)</td>
+ <td>x, n: INTEGER</td>
+ <td>INTEGER</td>
+ <td class="last">logical shift left, x * 2<sup>n</sup></td>
+ </tr>
+ <tr>
+ <td class="first">ASR(x, n)</td>
+ <td>x, n: INTEGER</td>
+ <td>INTEGER</td>
+ <td class="last">signed shift right, x DIV 2<sup>n</sup></td>
+ </tr>
+ <tr>
+ <td class="first">ROR(x, n)</td>
+ <td>x, n: INTEGER</td>
+ <td>INTEGER</td>
+ <td class="last">x rotated right by n bits</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p><em>Type conversion functions</em>:</p>
+
+ <div class="table">
+ <table class="header">
+ <tbody><tr>
+ <th class="first">Name</th>
+ <th>Argument type</th>
+ <th>Result type</th>
+ <th class="last">Function</th>
+ </tr>
+ <tr class="second">
+ <td class="first">Floor(x)</td>
+ <td>Real</td>
+ <td>Int</td>
+ <td class="last">truncation</td>
+ </tr>
+ <tr>
+ <td class="first">AsReal(x)</td>
+ <td>Int</td>
+ <td>Real</td>
+ <td class="last">identity</td>
+ </tr>
+ <tr>
+ <td class="first">AsInt(x)</td>
+ <td>Char, Bool, Set</td>
+ <td>Int</td>
+ <td class="last">ordinal number of x</td>
+ </tr>
+ <tr>
+ <td class="first">AsChar(x)</td>
+ <td>Int</td>
+ <td>Char</td>
+ <td style="white-space: normal">character with ordinal number x</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p><em>Proper procedures</em>:</p>
+
+ <div class="table">
+ <table class="header">
+ <tbody><tr>
+ <th class="first">Name</th>
+ <th>Argument types</th>
+ <th class="last">Function</th>
+ </tr>
+ <tr class="group-first second">
+ <td class="first">Increment(v)</td>
+ <td>Integer</td>
+ <td class="last">v := v + 1</td>
+ </tr>
+ <tr>
+ <td class="first">Increment(v, n)</td>
+ <td>Int</td>
+ <td class="last">v := v + n</td>
+ </tr>
+ <tr class="group-first">
+ <td class="first">Decrement(v)</td>
+ <td>Int</td>
+ <td class="last">v := v - 1</td>
+ </tr>
+ <tr>
+ <td class="first">Decrement(v, n)</td>
+ <td>Int</td>
+ <td class="last">v := v - n</td>
+ </tr>
+ <tr class="group-first">
+ <td class="first">Include(v, x)</td>
+ <td>v: Set; x: Int</td>
+ <td class="last">v := v + {x}</td>
+ </tr>
+ <tr>
+ <td class="first">Exclude(v, x)</td>
+ <td>v: Set; x: Int</td>
+ <td class="last">v := v - {x}</td>
+ </tr>
+ <tr class="group-first">
+ <td class="first">New(v)</td>
+ <td>pointer type</td>
+ <td class="last">allocate v^</td>
+ </tr>
+ <tr class="group-first">
+ <td class="first">Assert(b)</td>
+ <td>Bool</td>
+ <td class="last">abort, if ~b</td>
+ </tr>
+ </tbody></table>
+ </div>
+
+ <p>The function Floor(<var>x</var>) yields the largest integer not greater than <var>x</var>.</p>
+
+ <pre>Floor(1.5) = 1 Floor(-1.5) = -2
+</pre>
+
+ <h2><a name="sec11">11. Modules</a></h2>
+
+ <p>A module is a collection of declarations of constants, types, variables, and procedures, and a sequence of statements for the purpose of assigning initial values to the variables. A module typically constitutes a text that is compilable as a unit.</p>
+
+ <pre>module = MODULE ident ";" [ImportList] DeclarationSequence
+ [BEGIN StatementSequence] END ident "." .
ImportList = IMPORT import {"," import} ";" .
Import = ident [":=" ident].
</pre>
- <p>The import list specifies the modules of which the module is a client. If an identifier x is exported from a module M, and if M is listed in a module's import list, then x is referred to as M.x. If the form “M := M1” is used in the import list, an exported object x declared within M1 is referenced in the importing module as M.x .</p>
+ <p>The import list specifies the modules of which the module is a client. If an identifier x is exported from a module M, and if M is listed in a module's import list, then x is referred to as M.x. If the form “M := M1” is used in the import list, an exported object x declared within M1 is referenced in the importing module as M.x .</p>
- <p>Identifiers that are to be visible in client modules, i.e. which are to be exported, must be marked by an asterisk (export mark) in their declaration. Variables are always exported in read-only mode.</p>
+ <p>Identifiers that are to be visible in client modules, i.e. which are to be exported, must be marked by an asterisk (export mark) in their declaration. Variables are always exported in read-only mode.</p>
- <p>The statement sequence following the symbol BEGIN is executed when the module is added to a system (loaded). Individual (parameterless) procedures can thereafter be activated from the system, and these procedures serve as commands.</p>
+ <p>The statement sequence following the symbol BEGIN is executed when the module is added to a system (loaded). Individual (parameterless) procedures can thereafter be activated from the system, and these procedures serve as commands.</p>
- <p>Example:</p>
+ <p>Example:</p>
- <pre>MODULE Out; (*exported procedures: Write, WriteInt, WriteLn*)
- IMPORT Texts, Oberon;
- VAR W: Texts.Writer;
+ <pre>MODULE Out; (*exported procedures: Write, WriteInt, WriteLn*)
+ IMPORT Texts, Oberon;
+ VAR W: Texts.Writer;
- PROCEDURE Write*(ch: CHAR);
- BEGIN Texts.Write(W, ch)
- END;
+ PROCEDURE Write*(ch: CHAR);
+ BEGIN Texts.Write(W, ch)
+ END;
- PROCEDURE WriteInt*(x, n: INTEGER);
- VAR i: INTEGER; a: ARRAY 16 OF CHAR;
- BEGIN i := 0;
- IF x < 0 THEN Texts.Write(W, "-"); x := -x END ;
- REPEAT a[i] := CHR(x MOD 10 + ORD("0")); x := x DIV 10; INC(i) UNTIL x = 0;
- REPEAT Texts.Write(W, " "); DEC(n) UNTIL n <= i;
- REPEAT DEC(i); Texts.Write(W, a[i]) UNTIL i = 0
- END WriteInt;
+ PROCEDURE WriteInt*(x, n: INTEGER);
+ VAR i: INTEGER; a: ARRAY 16 OF CHAR;
+ BEGIN i := 0;
+ IF x < 0 THEN Texts.Write(W, "-"); x := -x END ;
+ REPEAT a[i] := CHR(x MOD 10 + ORD("0")); x := x DIV 10; INC(i) UNTIL x = 0;
+ REPEAT Texts.Write(W, " "); DEC(n) UNTIL n <= i;
+ REPEAT DEC(i); Texts.Write(W, a[i]) UNTIL i = 0
+ END WriteInt;
- PROCEDURE WriteLn*;
- BEGIN Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
- END WriteLn;
+ PROCEDURE WriteLn*;
+ BEGIN Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
+ END WriteLn;
BEGIN Texts.OpenWriter(W)
END Out.
</pre>
- <h2><a name="appendix">Appendix</a></h2>
+ <h2><a name="appendix">Appendix</a></h2>
- <h3>The Syntax of Oberon</h3>
+ <h3>The Syntax of Oberon</h3>
- <pre>letter = "A" | "B" | ... | "Z" | "a" | "b" | ... | "z".
+ <pre>letter = "A" | "B" | ... | "Z" | "a" | "b" | ... | "z".
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9".
hexDigit = digit | "A" | "B" | "C" | "D" | "E" | "F".
</pre>
- <pre>ident = letter {letter | digit}.
+ <pre>ident = letter {letter | digit}.
qualident = [ident "."] ident.
identdef = ident ["*"].
</pre>
- <pre>integer = digit {digit} | digit {hexDigit} "H".
+ <pre>integer = digit {digit} | digit {hexDigit} "H".
real = digit {digit} "." {digit} [ScaleFactor].
ScaleFactor = "E" ["+" | "-"] digit {digit}.
number = integer | real.
string = """ {character} """ | digit {hexDigit} "X".
</pre>
- <pre>ConstDeclaration = identdef "=" ConstExpression.
+ <pre>ConstDeclaration = identdef "=" ConstExpression.
ConstExpression = expression.
</pre>
- <pre>TypeDeclaration = identdef "=" type.
+ <pre>TypeDeclaration = identdef "=" type.
type = qualident | ArrayType | RecordType | PointerType | ProcedureType.
ArrayType = ARRAY length {"," length} OF type.
length = ConstExpression.
ProcedureType = PROCEDURE [FormalParameters].
</pre>
- <pre>VariableDeclaration = IdentList ":" type.
+ <pre>VariableDeclaration = IdentList ":" type.
</pre>
- <pre>expression = SimpleExpression [relation SimpleExpression].
+ <pre>expression = SimpleExpression [relation SimpleExpression].
relation = "=" | "#" | "<" | "<=" | ">" | ">=" | IN | IS.
SimpleExpression = ["+" | "-"] term {AddOperator term}.
AddOperator = "+" | "-" | OR.
term = factor {MulOperator factor}.
MulOperator = "*" | "/" | DIV | MOD | "&".
factor = number | string | NIL | TRUE | FALSE |
- set | designator [ActualParameters] | "(" expression ")" | "~" factor.
+ set | designator [ActualParameters] | "(" expression ")" | "~" factor.
designator = qualident {selector}.
selector = "." ident | "[" ExpList "]" | "^" | "(" qualident ")".
set = "{" [element {"," element}] "}".
ActualParameters = "(" [ExpList] ")" .
</pre>
- <pre>statement = [assignment | ProcedureCall | IfStatement | CaseStatement |
- WhileStatement | RepeatStatement | ForStatement].
+ <pre>statement = [assignment | ProcedureCall | IfStatement | CaseStatement |
+ WhileStatement | RepeatStatement | ForStatement].
assignment = designator ":=" expression.
ProcedureCall = designator [ActualParameters].
StatementSequence = statement {";" statement}.
IfStatement = IF expression THEN StatementSequence
- {ELSIF expression THEN StatementSequence}
- [ELSE StatementSequence] END.
+ {ELSIF expression THEN StatementSequence}
+ [ELSE StatementSequence] END.
CaseStatement = CASE expression OF case {"|" case} END.
case = [CaseLabelList ":" StatementSequence].
CaseLabelList = LabelRange {"," LabelRange}.
LabelRange = label [".." label].
label = integer | string | qualident.
WhileStatement = WHILE expression DO StatementSequence
- {ELSIF expression DO StatementSequence} END.
+ {ELSIF expression DO StatementSequence} END.
RepeatStatement = REPEAT StatementSequence UNTIL expression.
ForStatement = FOR ident ":=" expression TO expression [BY ConstExpression]
- DO StatementSequence END.
+ DO StatementSequence END.
</pre>
- <pre>ProcedureDeclaration = ProcedureHeading ";" ProcedureBody ident.
+ <pre>ProcedureDeclaration = ProcedureHeading ";" ProcedureBody ident.
ProcedureHeading = PROCEDURE identdef [FormalParameters].
ProcedureBody = DeclarationSequence [BEGIN StatementSequence]
- [RETURN expression] END.
+ [RETURN expression] END.
DeclarationSequence = [CONST {ConstDeclaration ";"}]
- [TYPE {TypeDeclaration ";"}]
- [VAR {VariableDeclaration ";"}]
- {ProcedureDeclaration ";"}.
+ [TYPE {TypeDeclaration ";"}]
+ [VAR {VariableDeclaration ";"}]
+ {ProcedureDeclaration ";"}.
FormalParameters = "(" [FPSection {";" FPSection}] ")" [":" qualident].
FPSection = [VAR] ident {"," ident} ":" FormalType.
FormalType = {ARRAY OF} qualident.
</pre>
- <pre>module = MODULE ident ";" [ImportList] DeclarationSequence
- [BEGIN StatementSequence] END ident "." .
+ <pre>module = MODULE ident ";" [ImportList] DeclarationSequence
+ [BEGIN StatementSequence] END ident "." .
ImportList = IMPORT import {"," import} ";".
import = ident [":=" ident].
</pre>
-
+
</body></html>
var f: Files.File;
begin
f := Files.Old("FilesTest.obn");
- Assert(f # nil);
+ Assert(f != nil);
Assert(f is Files.File)
end TestOld;
var f: Files.File;
begin
f := Files.New("NewTest");
- Assert(f # nil);
+ Assert(f != nil);
Assert(f is Files.File)
end TestNew;
end IsRider;
begin
f := Files.New("RegisterTest");
- Assert(f # nil);
+ Assert(f != nil);
Assert(IsRider(r));
Files.Register(f);
f := Files.Old("RegisterTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.Delete("RegisterTest", res);
Assert(res = 0);
f := Files.New("RegisterTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.Write(r, 37);
Files.Close(f);
Assert(Files.Length(f) = 1);
f := Files.Old("RegisterTest");
- Assert(f # nil);
+ Assert(f != nil);
Assert(Files.Length(f) = 1);
Files.Delete("RegisterTest", res);
Assert(res = 0)
r: Files.Rider;
begin
f := Files.New("CloseTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.Write(r, 65);
Assert(Files.Length(f) <= 1);
r: Files.Rider;
begin
f := Files.New("PurgeTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.Write(r, 65);
Files.Purge(f);
res: Int;
begin
f := Files.New("DeleteTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.Register(f);
f := Files.Old("DeleteTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.Delete("DeleteTest", res);
Assert(res = 0);
f := Files.Old("DeleteTest");
res: Int;
begin
f := Files.New("RenameTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.Register(f);
f := Files.Old("RenameTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.Rename("RenameTest", "RenameTest1", res);
Assert(res = 0);
f := Files.Old("RenameTest");
Assert(f = nil);
f := Files.Old("RenameTest1");
- Assert(f # nil);
+ Assert(f != nil);
Files.Delete("RenameTest1", res);
Assert(res = 0)
res: Int;
begin
f := Files.New("LengthTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.Register(f);
Assert(Files.Length(f) = 0);
Files.Delete("LengthTest", res);
hour, minute, second, year, month, day: Int;
begin
f := Files.Old("FilesTest.obn");
- Assert(f # nil);
+ Assert(f != nil);
Files.GetDate(f, t, d);
hour := t div 4096;
Assert(hour >= 0);
r: Files.Rider;
begin
f := Files.New("SetTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Assert(~r.eof)
end TestSetPos;
r: Files.Rider;
begin
f := Files.New("PosTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Assert(Files.Pos(r) = 0)
end TestPos;
r: Files.Rider;
begin
f := Files.New("BaseTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Assert(Files.Base(r) = f)
end TestBase;
b: Byte;
begin
f := Files.New("ReadWriteTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.Write(r, 65);
Files.Close(f);
i: Int;
begin
f := Files.New("ReadWriteIntTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.WriteInt(r, 100);
x: Real;
begin
f := Files.New("ReadWriteRealTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.WriteReal(r, 3.14);
i: Int;
begin
f := Files.New("ReadWriteNumTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.WriteNum(r, 100);
s: array 32 of Char;
begin
f := Files.New("ReadWriteStringTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.WriteString(r, "hello");
b: Bool;
begin
f := Files.New("ReadWriteBoolTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.WriteBool(r, true);
for i := 0 to Length(buf) - 1 do buf[i] := i + 1 end;
f := Files.New("ReadWriteBytesTest");
- Assert(f # nil);
+ Assert(f != nil);
Files.SetPos(r, f, 0);
Files.WriteBytes(r, buf, Length(buf));
Out.Ln;
repeat
n := Input.Available()
- until n # 0;
+ until n != 0;
Assert(n > 0);
Out.String("OK");
Out.Ln;
var i: Int;
begin
i := 0;
- while s[i] # 0X do
+ while s[i] != 0X do
Increment(i)
end
return i
repeat
Increment(idxs);
idxp := 0;
- while (pattern[idxp] # 0X) & (s[idxs + idxp] = pattern[idxp]) do
+ while (pattern[idxp] != 0X) & (s[idxs + idxp] = pattern[idxp]) do
Increment(idxp)
end
until (pattern[idxp] = 0X) or (s[idxs + idxp] = 0X);
var i: Int;
begin
i := 0;
- while s[i] # 0X do
+ while s[i] != 0X do
if (s[i] >= "a") & (s[i] <= "z") then
s[i] := AsChar(AsInt("A") + AsInt(s[i]) - AsInt("a"));
end;
}
switch (Trees_Symbol(opNode)) {
- case '#':
+ case NOT_EQ:
fprintf(file, "!=");
break;
case '&':
switch (Trees_Symbol(opNode)) {
case '=':
- case '#':
+ case NOT_EQ:
case '<':
case LE:
case '>':
if (node != NULL) {
symbol = Trees_Symbol(node);
switch (symbol) {
- case '#':
+ case NOT_EQ:
case '&':
case '*':
case '+':
"<=" return LE;
">=" return GE;
+"!=" return NOT_EQ;
-[][*+/&~.,;|({^:)}=#<>-] return yytext[0];
+[][*+/&~.,;|({^:)}=<>-] return yytext[0];
{WORD} {
int token;
%token ARRAY BEGIN_ BY CASE CONST DIV DO ELSE ELSIF END FALSE FOR IF IMPORT IS MOD MODULE NIL OF OR POINTER PROCEDURE RECORD REPEAT RETURN THEN TO TRUE TYPE UNTIL VAR WHILE
/*two-character operators and delimiters*/
-%token BECOMES DOTDOT GE LE
+%token BECOMES DOTDOT GE LE NOT_EQ
/*tokens with semantic values*/
%token <ident> IDENT
{
$$ = '=';
}
- | '#'
+ | NOT_EQ
{
- $$ = '#';
+ $$ = NOT_EQ;
}
| '<'
{
break;
}
break;
- case '#':
+ case NOT_EQ:
switch (Trees_Symbol(expA)) {
case TRUE:
case FALSE:
case '=':
result = "=";
break;
- case '#':
+ case NOT_EQ:
result = "#";
break;
case '<':
result = firstTypeSym == TREES_BOOLEAN_TYPE;
break;
case '=':
- case '#':
+ case NOT_EQ:
switch (firstTypeSym) {
case TREES_BOOLEAN_TYPE:
case TREES_REAL_TYPE:
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 15
-#define YY_END_OF_BUFFER 16
+#define YY_NUM_RULES 16
+#define YY_END_OF_BUFFER 17
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static const flex_int16_t yy_acclist[53] =
+static const flex_int16_t yy_acclist[56] =
{ 0,
- 16, 14, 15, 1, 14, 15, 2, 15, 14, 15,
- 7, 14, 15, 7, 14, 15, 7, 14, 15, 8201,
- 14, 15,16393, 7, 14, 15, 7, 14, 15, 7,
- 14, 15, 8, 14, 15, 1, 11, 13, 4, 10,
- 8201,16393, 8201,16393, 12, 3, 5, 6, 8, 8201,
- 10, 10
+ 17, 15, 16, 1, 15, 16, 2, 16, 15, 16,
+ 15, 16, 8, 15, 16, 8, 15, 16, 8, 15,
+ 16, 8202, 15, 16,16394, 8, 15, 16, 8, 15,
+ 16, 8, 15, 16, 9, 15, 16, 1, 7, 12,
+ 14, 4, 11, 8202,16394, 8202,16394, 13, 3, 5,
+ 6, 9, 8202, 11, 11
} ;
-static const flex_int16_t yy_accept[39] =
+static const flex_int16_t yy_accept[41] =
{ 0,
- 1, 1, 1, 2, 4, 7, 9, 11, 14, 17,
- 20, 24, 27, 30, 33, 36, 37, 37, 38, 39,
- 40, 41, 43, 43, 45, 46, 47, 48, 49, 50,
- 50, 51, 52, 52, 52, 52, 53, 53
+ 1, 1, 1, 2, 4, 7, 9, 11, 13, 16,
+ 19, 22, 26, 29, 32, 35, 38, 39, 40, 40,
+ 41, 42, 43, 44, 46, 46, 48, 49, 50, 51,
+ 52, 53, 53, 54, 55, 55, 55, 55, 56, 56
} ;
static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 4, 5, 1, 1, 5, 1, 6,
- 5, 7, 8, 5, 8, 9, 5, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 11, 5, 12,
- 13, 14, 1, 1, 15, 15, 15, 15, 16, 15,
- 17, 18, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 19, 17, 17,
- 5, 1, 5, 5, 20, 1, 17, 17, 17, 17,
-
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 5, 5, 5, 5, 1, 1, 1, 1,
+ 1, 2, 4, 5, 1, 1, 1, 6, 1, 7,
+ 6, 8, 9, 6, 9, 10, 6, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 12, 6, 13,
+ 14, 15, 1, 1, 16, 16, 16, 16, 17, 16,
+ 18, 19, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 20, 18, 18,
+ 6, 1, 6, 6, 21, 1, 18, 18, 18, 18,
+
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 6, 6, 6, 6, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
-static const YY_CHAR yy_meta[21] =
+static const YY_CHAR yy_meta[22] =
{ 0,
- 1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
- 1, 1, 1, 1, 3, 3, 3, 3, 3, 3
+ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 3, 1, 1, 1, 1, 3, 3, 3, 3, 3,
+ 3
} ;
-static const flex_int16_t yy_base[40] =
+static const flex_int16_t yy_base[42] =
{ 0,
- 0, 0, 55, 56, 52, 56, 49, 56, 45, 42,
- 12, 37, 36, 35, 27, 44, 41, 56, 56, 56,
- 16, 0, 14, 35, 56, 56, 56, 56, 23, 22,
- 56, 19, 26, 32, 30, 28, 56, 36, 30
+ 0, 0, 57, 58, 54, 58, 41, 49, 58, 45,
+ 42, 12, 37, 36, 35, 27, 45, 58, 41, 58,
+ 58, 58, 16, 0, 14, 35, 58, 58, 58, 58,
+ 23, 22, 58, 19, 26, 32, 30, 28, 58, 37,
+ 31
} ;
-static const flex_int16_t yy_def[40] =
+static const flex_int16_t yy_def[42] =
{ 0,
- 37, 1, 37, 37, 37, 37, 38, 37, 37, 37,
- 37, 37, 37, 37, 39, 37, 38, 37, 37, 37,
- 37, 11, 11, 37, 37, 37, 37, 37, 39, 39,
- 37, 37, 37, 37, 37, 37, 0, 37, 37
+ 39, 1, 39, 39, 39, 39, 39, 40, 39, 39,
+ 39, 39, 39, 39, 39, 41, 39, 39, 40, 39,
+ 39, 39, 39, 12, 12, 39, 39, 39, 39, 39,
+ 41, 41, 39, 39, 39, 39, 39, 39, 0, 39,
+ 39
} ;
-static const flex_int16_t yy_nxt[77] =
+static const flex_int16_t yy_nxt[80] =
{ 0,
- 4, 5, 6, 7, 8, 9, 8, 8, 10, 11,
- 12, 13, 8, 14, 15, 15, 15, 15, 15, 4,
- 21, 22, 37, 23, 31, 32, 23, 23, 32, 24,
- 25, 33, 29, 35, 33, 36, 17, 36, 17, 36,
- 31, 37, 30, 34, 18, 16, 30, 28, 27, 26,
- 20, 19, 18, 16, 37, 3, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37
+ 4, 5, 6, 7, 8, 9, 10, 9, 9, 11,
+ 12, 13, 14, 9, 15, 16, 16, 16, 16, 16,
+ 4, 23, 24, 39, 25, 33, 34, 25, 25, 34,
+ 26, 27, 35, 31, 37, 35, 38, 19, 38, 19,
+ 38, 33, 39, 32, 36, 20, 17, 32, 30, 29,
+ 28, 22, 21, 20, 18, 17, 39, 3, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39
} ;
-static const flex_int16_t yy_chk[77] =
+static const flex_int16_t yy_chk[80] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 11, 11, 23, 23, 21, 21, 11, 11, 32, 11,
- 11, 21, 39, 33, 32, 33, 38, 36, 38, 35,
- 34, 30, 29, 24, 17, 16, 15, 14, 13, 12,
- 10, 9, 7, 5, 3, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37
+ 1, 12, 12, 25, 25, 23, 23, 12, 12, 34,
+ 12, 12, 23, 41, 35, 34, 35, 40, 38, 40,
+ 37, 36, 32, 31, 26, 19, 17, 16, 15, 14,
+ 13, 11, 10, 8, 7, 5, 3, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39
} ;
extern int yy_flex_debug;
static int KeywordToken(const char word[]);
-#line 520 "lex.yy.c"
-#line 521 "lex.yy.c"
+#line 523 "lex.yy.c"
+#line 524 "lex.yy.c"
#define INITIAL 0
#line 49 "Oberon.l"
-#line 747 "lex.yy.c"
+#line 750 "lex.yy.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 38 )
+ if ( yy_current_state >= 40 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
*(yy_state_ptr)++ = yy_current_state;
++yy_cp;
}
- while ( yy_base[yy_current_state] != 56 );
+ while ( yy_base[yy_current_state] != 58 );
yy_find_action:
yy_current_state = *--(yy_state_ptr);
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 65 "Oberon.l"
-return yytext[0];
+#line 64 "Oberon.l"
+return NOT_EQ;
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 67 "Oberon.l"
+#line 66 "Oberon.l"
+return yytext[0];
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 68 "Oberon.l"
{
int token;
char *lexeme;
return token;
}
YY_BREAK
-case 9:
+case 10:
YY_RULE_SETUP
-#line 81 "Oberon.l"
+#line 82 "Oberon.l"
{
int base;
unsigned long int max, lexeme;
return INTEGER;
}
YY_BREAK
-case 10:
+case 11:
YY_RULE_SETUP
-#line 100 "Oberon.l"
+#line 101 "Oberon.l"
{
int n = sscanf(yytext, "%" OBNC_REAL_MOD_R "f", &yylval.real);
if (n != 1) {
return REAL;
}
YY_BREAK
-case 11:
+case 12:
YY_RULE_SETUP
-#line 108 "Oberon.l"
+#line 109 "Oberon.l"
{
int lexemeLen;
char *lexeme;
return STRING;
}
YY_BREAK
-case 12:
+case 13:
YY_RULE_SETUP
-#line 120 "Oberon.l"
+#line 121 "Oberon.l"
{
long ordinalNumber;
char *lexeme;
return STRING;
}
YY_BREAK
-case 13:
+case 14:
YY_RULE_SETUP
-#line 140 "Oberon.l"
+#line 141 "Oberon.l"
{
int linenoStart, level, ch;
}
}
YY_BREAK
-case 14:
+case 15:
YY_RULE_SETUP
-#line 179 "Oberon.l"
+#line 180 "Oberon.l"
{
if (isprint(yytext[0])) {
Oberon_PrintError("error: unexpected character: %c", yytext[0]);
exit(EXIT_FAILURE);
}
YY_BREAK
-case 15:
+case 16:
YY_RULE_SETUP
-#line 188 "Oberon.l"
+#line 189 "Oberon.l"
ECHO;
YY_BREAK
-#line 1012 "lex.yy.c"
+#line 1020 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 38 )
+ if ( yy_current_state >= 40 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 38 )
+ if ( yy_current_state >= 40 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 37);
+ yy_is_jam = (yy_current_state == 39);
if ( ! yy_is_jam )
*(yy_state_ptr)++ = yy_current_state;
#define YYTABLES_NAME "yytables"
-#line 188 "Oberon.l"
+#line 189 "Oberon.l"
static int Cmp(const void *word, const void *keywordPtr)
#undef yyTABLES_NAME
#endif
-#line 188 "Oberon.l"
+#line 189 "Oberon.l"
#line 471 "lex.yy.h"
{BECOMES, ""},
{'^', ""},
{'=', ""},
- {'#', ""},
+ {NOT_EQ, ""},
{'<', ""},
{'>', ""},
{LE, ""},
DOTDOT = 292,
GE = 293,
LE = 294,
- IDENT = 295,
- INTEGER = 296,
- REAL = 297,
- STRING = 298,
- TOKEN_END = 299
+ NOT_EQ = 295,
+ IDENT = 296,
+ INTEGER = 297,
+ REAL = 298,
+ STRING = 299,
+ TOKEN_END = 300
};
#endif
/* Tokens. */
#define DOTDOT 292
#define GE 293
#define LE 294
-#define IDENT 295
-#define INTEGER 296
-#define REAL 297
-#define STRING 298
-#define TOKEN_END 299
+#define NOT_EQ 295
+#define IDENT 296
+#define INTEGER 297
+#define REAL 298
+#define STRING 299
+#define TOKEN_END 300
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
const char *string;
Trees_Node node;
-#line 307 "y.tab.c"
+#line 309 "y.tab.c"
};
typedef union YYSTYPE YYSTYPE;
#define YYNSTATES 272
#define YYUNDEFTOK 2
-#define YYMAXUTOK 299
+#define YYMAXUTOK 300
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 53, 2, 2, 59, 2,
- 49, 50, 46, 56, 48, 57, 45, 58, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 52, 51,
- 54, 47, 55, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 59, 2,
+ 50, 51, 47, 56, 49, 57, 46, 58, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 53, 52,
+ 54, 48, 55, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 61, 2, 62, 63, 2, 2, 2, 2, 2,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45
};
#if YYDEBUG
"CASE", "CONST", "DIV", "DO", "ELSE", "ELSIF", "END", "FALSE", "FOR",
"IF", "IMPORT", "IS", "MOD", "MODULE", "NIL", "OF", "OR", "POINTER",
"PROCEDURE", "RECORD", "REPEAT", "RETURN", "THEN", "TO", "TRUE", "TYPE",
- "UNTIL", "VAR", "WHILE", "BECOMES", "DOTDOT", "GE", "LE", "IDENT",
- "INTEGER", "REAL", "STRING", "TOKEN_END", "'.'", "'*'", "'='", "','",
- "'('", "')'", "';'", "':'", "'#'", "'<'", "'>'", "'+'", "'-'", "'/'",
+ "UNTIL", "VAR", "WHILE", "BECOMES", "DOTDOT", "GE", "LE", "NOT_EQ",
+ "IDENT", "INTEGER", "REAL", "STRING", "TOKEN_END", "'.'", "'*'", "'='",
+ "','", "'('", "')'", "';'", "':'", "'<'", "'>'", "'+'", "'-'", "'/'",
"'&'", "'~'", "'['", "']'", "'^'", "'|'", "$accept", "qualident",
"identdef", "ExportMarkOpt", "number", "ConstDeclaration",
"ConstExpression", "TypeDeclaration", "TypeIdentDef", "type",
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 46, 42, 61, 44, 40,
- 41, 59, 58, 35, 60, 62, 43, 45, 47, 38,
+ 295, 296, 297, 298, 299, 300, 46, 42, 61, 44,
+ 40, 41, 59, 58, 60, 62, 43, 45, 47, 38,
126, 91, 93, 94, 124
};
# endif
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- -9, -11, 35, 5, -124, -124, 34, 33, 71, -124,
- 50, 32, -124, -124, 66, 59, 53, -124, 33, -124,
- 55, 100, -124, 98, -124, 79, -124, -124, -124, 72,
- 70, 68, -34, 80, -34, 100, -34, -124, 85, -124,
- -124, -124, -124, 73, -124, -124, -124, -124, -124, 82,
- -124, -124, 55, -124, -124, -34, -124, -124, -124, -124,
- 8, 63, 103, 93, 101, -124, 104, 99, 120, 65,
- -34, 100, 89, 55, 111, 90, 87, 13, -124, -124,
+ 8, -3, 19, -2, -124, -124, 49, 28, 69, -124,
+ 48, 3, -124, -124, 89, 75, 71, -124, 28, -124,
+ 76, 38, -124, 103, -124, 84, -124, -124, -124, 77,
+ 78, 73, 30, 82, 30, 38, 30, -124, 91, -124,
+ -124, -124, -124, 79, -124, -124, -124, -124, -124, 87,
+ -124, -124, 76, -124, -124, 30, -124, -124, -124, -124,
+ 65, 20, 107, 94, 104, -124, 106, 99, 123, -26,
+ 30, 38, 90, 76, 112, 92, 86, 6, -124, -124,
-124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
- -34, 63, -124, -124, -124, -124, -124, -124, -34, 63,
- -124, -1, -124, -124, 49, -34, -34, 100, -34, 100,
- 102, -37, -34, -124, -124, -124, -124, -124, -124, -20,
- 88, 55, 92, 94, 95, -124, -124, -34, 116, -124,
- 105, 96, -124, -124, -124, 13, -124, 55, -124, 13,
- -124, 95, 31, -1, 106, -124, -124, -124, -124, -124,
- -124, 63, -124, -124, -124, -4, -124, -18, -124, 110,
- -124, -124, 142, -124, -124, -124, -124, -124, -124, 19,
- -38, 55, 13, -124, -124, -124, 71, -13, -124, -124,
- -124, -7, -124, -124, 109, -124, 115, -124, 138, 107,
- -124, 0, -124, -124, -124, -124, -124, 49, 49, 100,
- 49, -34, 147, 97, 30, -34, -124, -124, -124, -124,
- 66, -124, 112, 108, -124, 121, -124, -34, -124, 113,
- -124, -124, 55, 13, -124, -124, -124, -124, -124, 100,
- 100, -34, 152, -34, -124, -124, 132, 117, 133, -124,
- 18, -124, -124, -124, -124, 155, -124, 141, -124, 162,
- -34, 160, 109, -124, -124, 134, -124, -124, 100, 100,
- -124, 136, -124, -124, -124, 10, -124, -124, -124, 156,
+ 30, 20, -124, -124, -124, -124, -124, -124, 30, 20,
+ -124, -1, -124, -124, 67, 30, 30, 38, 30, 38,
+ 98, -34, 30, -124, -124, -124, -124, -124, -124, -10,
+ 93, 76, 95, 96, 101, -124, -124, 30, 111, -124,
+ 105, 97, -124, -124, -124, 6, -124, 76, -124, 6,
+ -124, 101, 33, -1, 108, -124, -124, -124, -124, -124,
+ -124, 20, -124, -124, -124, -4, -124, 18, -124, 109,
+ -124, -124, 136, -124, -124, -124, -124, -124, -124, -22,
+ -36, 76, 6, -124, -124, -124, 69, -20, -124, -124,
+ -124, -7, -124, -124, 113, -124, 115, -124, 131, 110,
+ -124, 42, -124, -124, -124, -124, -124, 67, 67, 38,
+ 67, 30, 139, 81, 102, 30, -124, -124, -124, -124,
+ 89, -124, 114, 116, -124, 117, -124, 30, -124, 118,
+ -124, -124, 76, 6, -124, -124, -124, -124, -124, 38,
+ 38, 30, 144, 30, -124, -124, 132, 119, 127, -124,
+ 57, -124, -124, -124, -124, 150, -124, 138, -124, 160,
+ 30, 161, 113, -124, -124, 135, -124, -124, 38, 38,
+ -124, 137, -124, -124, -124, 7, -124, -124, -124, 151,
-124, -124
};
145, 147, 137, 5, 4, 55, 135, 53, 54, 104,
42, 0, 0, 0, 0, 98, 0, 0, 0, 74,
55, 91, 0, 142, 132, 0, 0, 0, 9, 10,
- 50, 58, 49, 47, 44, 45, 46, 48, 56, 57,
+ 50, 58, 49, 47, 45, 44, 46, 48, 56, 57,
55, 0, 70, 68, 69, 7, 8, 67, 55, 0,
66, 51, 59, 71, 108, 55, 55, 91, 55, 91,
0, 55, 55, 79, 75, 92, 96, 163, 33, 0,
{
-124, -99, -19, -124, -124, -124, -51, -124, -124, -123,
-124, -124, -124, -40, -124, -124, -124, -124, -124, -124,
- -43, 118, -124, -124, -124, -124, 39, -124, -30, -124,
- 91, -124, -124, 114, -124, -92, -55, -124, -124, 74,
- 119, -124, -124, -35, -124, -124, -33, -124, -124, -124,
- -124, -124, -15, -124, -14, -17, -124, -124, -124, -124,
+ -43, 120, -124, -124, -124, -124, 39, -124, -30, -124,
+ 100, -124, -124, 121, -124, -92, -55, -124, -124, 70,
+ 125, -124, -124, -35, -124, -124, -33, -124, -124, -124,
+ -124, -124, -16, -124, -15, -14, -124, -124, -124, -124,
-124, -124, -124, -124, -124, -124, -25, -124, 12, -124,
-124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
- -124, -49, -124, -124, -124, -124, -124, -124, -124, -124,
- -124, 174, -124, -124
+ -124, -54, -124, -124, -124, -124, -124, -124, -124, -124,
+ -124, 171, -124, -124
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yytable[] =
{
67, 30, 59, 68, 78, 154, 103, 145, 146, 196,
- 205, 1, 187, 167, 269, 216, 192, 127, 147, 57,
- 58, 211, 57, 58, 207, 79, 80, -157, 171, 4,
- 198, 81, 172, 75, 199, 5, 103, 128, 129, 130,
- 115, 217, 233, 234, 103, 148, 82, 83, 171, 209,
- 131, 7, 223, 131, 81, 84, 6, 149, 150, 195,
- 197, 85, 86, 87, 88, 89, 255, 205, 144, 206,
- 256, 21, 163, 10, 165, 160, 161, 92, 164, 13,
- 18, 168, 168, 19, 93, 218, 16, 88, 89, 131,
- 152, 24, 153, 27, 94, 29, 103, 79, 154, 154,
- 244, 154, 174, 37, 95, 96, 97, 32, 230, 231,
- 110, 49, 98, 50, 111, 33, 34, 55, 53, 56,
- 63, 70, 72, 99, 71, 104, 112, 35, 113, 105,
- 109, 106, 108, 107, 117, 36, 121, 125, 126, 173,
- 37, 186, 166, 175, 177, 176, 183, 200, 201, 131,
- 228, 221, 208, 262, 184, 220, 194, 229, 222, 238,
- 250, 239, 237, 242, 226, 248, 270, 211, 257, 252,
- 258, 79, 259, 261, 263, 235, 268, 241, 271, 243,
- 193, 142, 224, 227, 225, 236, 170, 79, 210, 254,
- 116, 119, 28, 0, 245, 246, 0, 0, 247, 0,
- 249, 0, 0, 0, 0, 143, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 127, 269, 187, 205, 211, 216, 192, 167, 147, 5,
+ 110, -157, 57, 58, 111, 79, 207, 205, 1, 206,
+ 128, 129, 130, 75, 92, 112, 103, 113, 4, 171,
+ 115, 93, 217, 172, 103, 32, 148, 131, 131, 209,
+ 6, 94, 18, 33, 34, 19, 81, 149, 150, 195,
+ 197, 37, 95, 96, 97, 35, 7, 198, 144, 10,
+ 98, 199, 163, 36, 165, 160, 161, 13, 164, 37,
+ 99, 168, 168, 80, 16, 218, 57, 58, 81, 88,
+ 89, 171, 230, 231, 21, 223, 103, 79, 154, 154,
+ 244, 154, 174, 82, 83, 84, 255, 24, 131, 152,
+ 256, 153, 27, 85, 233, 234, 49, 29, 50, 86,
+ 87, 88, 89, 63, 53, 56, 55, 70, 72, 104,
+ 105, 71, 108, 109, 106, 107, 117, 121, 126, 166,
+ 125, 183, 201, 186, 221, 173, 200, 175, 176, 229,
+ 228, 177, 208, 262, 131, 184, 220, 248, 239, 194,
+ 250, 211, 222, 257, 226, 237, 270, 258, 238, 242,
+ 259, 79, 252, 271, 261, 235, 263, 241, 268, 243,
+ 193, 224, 170, 225, 254, 236, 227, 79, 210, 28,
+ 142, 0, 0, 119, 245, 246, 116, 0, 247, 0,
+ 249, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 143, 0, 0, 0, 0, 0, 0, 0,
260, 0, 0, 266, 267
};
static const yytype_int16 yycheck[] =
{
35, 20, 32, 36, 55, 104, 61, 99, 9, 13,
- 48, 20, 135, 50, 4, 22, 139, 4, 19, 56,
- 57, 34, 56, 57, 62, 55, 18, 40, 48, 40,
- 48, 23, 52, 52, 52, 0, 91, 24, 25, 26,
- 70, 48, 12, 13, 99, 46, 38, 39, 48, 172,
- 40, 17, 52, 40, 23, 47, 51, 58, 59, 151,
- 64, 53, 54, 55, 56, 57, 48, 48, 98, 50,
- 52, 5, 107, 40, 109, 105, 106, 14, 108, 8,
- 48, 111, 112, 51, 21, 184, 36, 56, 57, 40,
- 41, 32, 43, 40, 31, 40, 151, 127, 197, 198,
- 223, 200, 121, 40, 41, 42, 43, 7, 11, 12,
- 45, 13, 49, 34, 49, 15, 16, 47, 46, 51,
- 40, 36, 40, 60, 51, 22, 61, 27, 63, 36,
- 10, 30, 33, 29, 45, 35, 25, 47, 51, 51,
- 40, 45, 40, 51, 49, 51, 30, 37, 6, 40,
- 201, 13, 171, 252, 49, 40, 50, 10, 51, 51,
- 28, 40, 50, 50, 199, 13, 265, 34, 13, 52,
- 29, 201, 10, 13, 40, 205, 40, 217, 22, 222,
- 141, 90, 197, 200, 198, 210, 112, 217, 176, 238,
- 71, 73, 18, -1, 229, 230, -1, -1, 231, -1,
- 233, -1, -1, -1, -1, 91, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 4, 4, 135, 49, 34, 22, 139, 51, 19, 0,
+ 46, 41, 56, 57, 50, 55, 62, 49, 20, 51,
+ 24, 25, 26, 52, 14, 61, 91, 63, 41, 49,
+ 70, 21, 49, 53, 99, 7, 47, 41, 41, 172,
+ 52, 31, 49, 15, 16, 52, 23, 58, 59, 151,
+ 64, 41, 42, 43, 44, 27, 17, 49, 98, 41,
+ 50, 53, 107, 35, 109, 105, 106, 8, 108, 41,
+ 60, 111, 112, 18, 36, 184, 56, 57, 23, 56,
+ 57, 49, 11, 12, 5, 53, 151, 127, 197, 198,
+ 223, 200, 121, 38, 39, 40, 49, 32, 41, 42,
+ 53, 44, 41, 48, 12, 13, 13, 41, 34, 54,
+ 55, 56, 57, 41, 47, 52, 48, 36, 41, 22,
+ 36, 52, 33, 10, 30, 29, 46, 25, 52, 41,
+ 48, 30, 6, 46, 13, 52, 37, 52, 52, 10,
+ 201, 50, 171, 252, 41, 50, 41, 13, 41, 51,
+ 28, 34, 52, 13, 199, 51, 265, 29, 52, 51,
+ 10, 201, 53, 22, 13, 205, 41, 217, 41, 222,
+ 141, 197, 112, 198, 238, 210, 200, 217, 176, 18,
+ 90, -1, -1, 73, 229, 230, 71, -1, 231, -1,
+ 233, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 91, -1, -1, -1, -1, -1, -1, -1,
250, -1, -1, 258, 259
};
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 20, 151, 152, 40, 0, 51, 17, 153, 154,
- 40, 155, 156, 8, 133, 134, 36, 157, 48, 51,
- 135, 5, 131, 158, 32, 136, 137, 40, 156, 40,
- 67, 70, 7, 15, 16, 27, 35, 40, 101, 105,
+ 0, 20, 151, 152, 41, 0, 52, 17, 153, 154,
+ 41, 155, 156, 8, 133, 134, 36, 157, 49, 52,
+ 135, 5, 131, 158, 32, 136, 137, 41, 156, 41,
+ 67, 70, 7, 15, 16, 27, 35, 41, 101, 105,
106, 107, 108, 109, 110, 114, 121, 123, 124, 13,
- 34, 139, 138, 46, 68, 47, 51, 56, 57, 93,
- 95, 96, 115, 40, 125, 93, 111, 108, 111, 102,
- 36, 51, 40, 140, 141, 67, 72, 73, 71, 93,
- 18, 23, 38, 39, 47, 53, 54, 55, 56, 57,
- 94, 97, 14, 21, 31, 41, 42, 43, 49, 60,
+ 34, 139, 138, 47, 68, 48, 52, 56, 57, 93,
+ 95, 96, 115, 41, 125, 93, 111, 108, 111, 102,
+ 36, 52, 41, 140, 141, 67, 72, 73, 71, 93,
+ 18, 23, 38, 39, 40, 48, 54, 55, 56, 57,
+ 94, 97, 14, 21, 31, 42, 43, 44, 50, 60,
69, 98, 100, 101, 22, 36, 30, 29, 33, 10,
- 45, 49, 61, 63, 103, 93, 105, 45, 67, 86,
- 92, 25, 128, 129, 130, 47, 51, 4, 24, 25,
- 26, 40, 66, 74, 75, 76, 79, 80, 87, 88,
- 89, 90, 95, 98, 93, 100, 9, 19, 46, 58,
- 59, 99, 41, 43, 66, 116, 117, 118, 119, 120,
- 93, 93, 126, 108, 93, 108, 40, 50, 93, 104,
- 104, 48, 52, 51, 67, 51, 51, 49, 91, 142,
- 71, 77, 78, 30, 49, 81, 45, 74, 83, 84,
- 85, 86, 74, 91, 50, 100, 13, 64, 48, 52,
- 37, 6, 127, 112, 122, 48, 50, 62, 67, 74,
- 133, 34, 143, 144, 146, 147, 22, 48, 66, 82,
- 40, 13, 51, 52, 117, 119, 108, 120, 71, 10,
- 11, 12, 113, 12, 13, 93, 131, 50, 51, 40,
- 148, 78, 50, 85, 74, 108, 108, 111, 13, 111,
- 28, 132, 52, 145, 146, 48, 52, 13, 29, 10,
- 93, 13, 66, 40, 149, 150, 108, 108, 40, 4,
+ 46, 50, 61, 63, 103, 93, 105, 46, 67, 86,
+ 92, 25, 128, 129, 130, 48, 52, 4, 24, 25,
+ 26, 41, 66, 74, 75, 76, 79, 80, 87, 88,
+ 89, 90, 95, 98, 93, 100, 9, 19, 47, 58,
+ 59, 99, 42, 44, 66, 116, 117, 118, 119, 120,
+ 93, 93, 126, 108, 93, 108, 41, 51, 93, 104,
+ 104, 49, 53, 52, 67, 52, 52, 50, 91, 142,
+ 71, 77, 78, 30, 50, 81, 46, 74, 83, 84,
+ 85, 86, 74, 91, 51, 100, 13, 64, 49, 53,
+ 37, 6, 127, 112, 122, 49, 51, 62, 67, 74,
+ 133, 34, 143, 144, 146, 147, 22, 49, 66, 82,
+ 41, 13, 52, 53, 117, 119, 108, 120, 71, 10,
+ 11, 12, 113, 12, 13, 93, 131, 51, 52, 41,
+ 148, 78, 51, 85, 74, 108, 108, 111, 13, 111,
+ 28, 132, 53, 145, 146, 49, 53, 13, 29, 10,
+ 93, 13, 66, 41, 149, 150, 108, 108, 41, 4,
66, 22
};
{
(yyval.node) = Trees_NewIdent((yyvsp[0].ident));
}
-#line 1706 "y.tab.c"
+#line 1709 "y.tab.c"
break;
case 3:
{
(yyval.node) = Trees_NewIdent(Util_String("%s.%s", (yyvsp[-2].ident), (yyvsp[0].ident)));
}
-#line 1714 "y.tab.c"
+#line 1717 "y.tab.c"
break;
case 4:
YYABORT;
}
}
-#line 1733 "y.tab.c"
+#line 1736 "y.tab.c"
break;
case 5:
{
(yyval.integer) = 1;
}
-#line 1741 "y.tab.c"
+#line 1744 "y.tab.c"
break;
case 6:
{
(yyval.integer) = 0;
}
-#line 1749 "y.tab.c"
+#line 1752 "y.tab.c"
break;
case 7:
{
(yyval.node) = Trees_NewInteger((yyvsp[0].integer));
}
-#line 1757 "y.tab.c"
+#line 1760 "y.tab.c"
break;
case 8:
{
(yyval.node) = Trees_NewReal((yyvsp[0].real));
}
-#line 1765 "y.tab.c"
+#line 1768 "y.tab.c"
break;
case 9:
YYABORT;
}
}
-#line 1782 "y.tab.c"
+#line 1785 "y.tab.c"
break;
case 10:
YYABORT;
}
}
-#line 1795 "y.tab.c"
+#line 1798 "y.tab.c"
break;
case 11:
YYABORT;
}
}
-#line 1819 "y.tab.c"
+#line 1822 "y.tab.c"
break;
case 12:
Table_Put((yyvsp[-1].node));
(yyval.node) = (yyvsp[-1].node);
}
-#line 1830 "y.tab.c"
+#line 1833 "y.tab.c"
break;
case 18:
exit(EXIT_FAILURE);
}
}
-#line 1851 "y.tab.c"
+#line 1854 "y.tab.c"
break;
case 19:
}
(yyval.node) = (yyvsp[-1].node);
}
-#line 1862 "y.tab.c"
+#line 1865 "y.tab.c"
break;
case 20:
{
(yyval.node) = Trees_NewNode(TREES_NOSYM, (yyvsp[0].node), NULL);
}
-#line 1870 "y.tab.c"
+#line 1873 "y.tab.c"
break;
case 21:
{
(yyval.node) = Trees_NewNode(TREES_NOSYM, (yyvsp[0].node), (yyvsp[-2].node));
}
-#line 1878 "y.tab.c"
+#line 1881 "y.tab.c"
break;
case 22:
YYABORT;
}
}
-#line 1899 "y.tab.c"
+#line 1902 "y.tab.c"
break;
case 23:
recordDeclarationStack = Trees_Right(recordDeclarationStack);
(yyval.node) = Types_NewRecord(Types_RecordBaseType((yyvsp[-2].node)), (yyvsp[-1].node));
}
-#line 1908 "y.tab.c"
+#line 1911 "y.tab.c"
break;
case 24:
}
recordDeclarationStack = Trees_NewNode(TREES_NOSYM, (yyval.node), recordDeclarationStack);
}
-#line 1920 "y.tab.c"
+#line 1923 "y.tab.c"
break;
case 25:
{
(yyval.node) = (yyvsp[-1].node);
}
-#line 1928 "y.tab.c"
+#line 1931 "y.tab.c"
break;
case 26:
{
(yyval.node) = NULL;
}
-#line 1936 "y.tab.c"
+#line 1939 "y.tab.c"
break;
case 27:
YYABORT;
}
}
-#line 1978 "y.tab.c"
+#line 1981 "y.tab.c"
break;
case 28:
Trees_ReverseList(&(yyvsp[0].node)); /*correct order*/
(yyval.node) = (yyvsp[0].node);
}
-#line 1987 "y.tab.c"
+#line 1990 "y.tab.c"
break;
case 29:
{
(yyval.node) = NULL;
}
-#line 1995 "y.tab.c"
+#line 1998 "y.tab.c"
break;
case 30:
{
(yyval.node) = Trees_NewNode(TREES_FIELD_LIST_SEQUENCE, (yyvsp[0].node), NULL);
}
-#line 2003 "y.tab.c"
+#line 2006 "y.tab.c"
break;
case 31:
}
(yyval.node) = Trees_NewNode(TREES_FIELD_LIST_SEQUENCE, (yyvsp[0].node), (yyvsp[-2].node));
}
-#line 2032 "y.tab.c"
+#line 2035 "y.tab.c"
break;
case 32:
YYABORT;
}
}
-#line 2082 "y.tab.c"
+#line 2085 "y.tab.c"
break;
case 33:
{
(yyval.node) = Trees_NewNode(TREES_IDENT_LIST, (yyvsp[0].node), NULL);
}
-#line 2090 "y.tab.c"
+#line 2093 "y.tab.c"
break;
case 34:
reversedIdents = Trees_NewNode(TREES_IDENT_LIST, (yyvsp[0].node), (yyvsp[-2].node));
(yyval.node) = reversedIdents;
}
-#line 2101 "y.tab.c"
+#line 2104 "y.tab.c"
break;
case 35:
YYABORT;
}
}
-#line 2137 "y.tab.c"
+#line 2140 "y.tab.c"
break;
case 36:
Trees_SetType(Types_NewPointer(NULL), currentTypeIdentdef); /*incomplete type*/
}
}
-#line 2147 "y.tab.c"
+#line 2150 "y.tab.c"
break;
case 37:
{
(yyval.node) = (yyvsp[0].node);
}
-#line 2155 "y.tab.c"
+#line 2158 "y.tab.c"
break;
case 38:
{
(yyval.node) = NULL;
}
-#line 2163 "y.tab.c"
+#line 2166 "y.tab.c"
break;
case 40:
{
(yyval.node) = Trees_NewLeaf(PROCEDURE);
}
-#line 2171 "y.tab.c"
+#line 2174 "y.tab.c"
break;
case 41:
exit(EXIT_FAILURE);
}
}
-#line 2207 "y.tab.c"
+#line 2210 "y.tab.c"
break;
case 43:
YYABORT;
}
}
-#line 2255 "y.tab.c"
+#line 2258 "y.tab.c"
break;
case 44:
{
(yyval.integer) = '=';
}
-#line 2263 "y.tab.c"
+#line 2266 "y.tab.c"
break;
case 45:
#line 746 "Oberon.y"
{
- (yyval.integer) = '#';
+ (yyval.integer) = NOT_EQ;
}
-#line 2271 "y.tab.c"
+#line 2274 "y.tab.c"
break;
case 46:
{
(yyval.integer) = '<';
}
-#line 2279 "y.tab.c"
+#line 2282 "y.tab.c"
break;
case 47:
{
(yyval.integer) = LE;
}
-#line 2287 "y.tab.c"
+#line 2290 "y.tab.c"
break;
case 48:
{
(yyval.integer) = '>';
}
-#line 2295 "y.tab.c"
+#line 2298 "y.tab.c"
break;
case 49:
{
(yyval.integer) = GE;
}
-#line 2303 "y.tab.c"
+#line 2306 "y.tab.c"
break;
case 50:
{
(yyval.integer) = IS;
}
-#line 2311 "y.tab.c"
+#line 2314 "y.tab.c"
break;
case 51:
}
}
}
-#line 2337 "y.tab.c"
+#line 2340 "y.tab.c"
break;
case 52:
}
assert((yyval.node) != NULL);
}
-#line 2367 "y.tab.c"
+#line 2370 "y.tab.c"
break;
case 53:
{
(yyval.integer) = '+';
}
-#line 2375 "y.tab.c"
+#line 2378 "y.tab.c"
break;
case 54:
{
(yyval.integer) = '-';
}
-#line 2383 "y.tab.c"
+#line 2386 "y.tab.c"
break;
case 55:
{
(yyval.integer) = -1;
}
-#line 2391 "y.tab.c"
+#line 2394 "y.tab.c"
break;
case 56:
{
(yyval.integer) = '+';
}
-#line 2399 "y.tab.c"
+#line 2402 "y.tab.c"
break;
case 57:
{
(yyval.integer) = '-';
}
-#line 2407 "y.tab.c"
+#line 2410 "y.tab.c"
break;
case 58:
{
(yyval.integer) = OR;
}
-#line 2415 "y.tab.c"
+#line 2418 "y.tab.c"
break;
case 60:
assert((yyval.node) != NULL);
}
-#line 2446 "y.tab.c"
+#line 2449 "y.tab.c"
break;
case 61:
{
(yyval.integer) = '*';
}
-#line 2454 "y.tab.c"
+#line 2457 "y.tab.c"
break;
case 62:
{
(yyval.integer) = '/';
}
-#line 2462 "y.tab.c"
+#line 2465 "y.tab.c"
break;
case 63:
{
(yyval.integer) = DIV;
}
-#line 2470 "y.tab.c"
+#line 2473 "y.tab.c"
break;
case 64:
{
(yyval.integer) = MOD;
}
-#line 2478 "y.tab.c"
+#line 2481 "y.tab.c"
break;
case 65:
{
(yyval.integer) = '&';
}
-#line 2486 "y.tab.c"
+#line 2489 "y.tab.c"
break;
case 67:
{
(yyval.node) = Trees_NewString((yyvsp[0].string));
}
-#line 2494 "y.tab.c"
+#line 2497 "y.tab.c"
break;
case 68:
(yyval.node) = Trees_NewLeaf(NIL);
Trees_SetType(Trees_NewLeaf(TREES_NIL_TYPE), (yyval.node));
}
-#line 2503 "y.tab.c"
+#line 2506 "y.tab.c"
break;
case 69:
{
(yyval.node) = Trees_NewBoolean(1);
}
-#line 2511 "y.tab.c"
+#line 2514 "y.tab.c"
break;
case 70:
{
(yyval.node) = Trees_NewBoolean(0);
}
-#line 2519 "y.tab.c"
+#line 2522 "y.tab.c"
break;
case 71:
}
assert((yyval.node) != NULL);
}
-#line 2543 "y.tab.c"
+#line 2546 "y.tab.c"
break;
case 72:
CheckIsValueExpression((yyvsp[-1].node));
(yyval.node) = (yyvsp[-1].node);
}
-#line 2552 "y.tab.c"
+#line 2555 "y.tab.c"
break;
case 73:
}
assert((yyval.node) != NULL);
}
-#line 2573 "y.tab.c"
+#line 2576 "y.tab.c"
break;
case 74:
(yyval.node) = designator;
}
}
-#line 2594 "y.tab.c"
+#line 2597 "y.tab.c"
break;
case 75:
(yyval.node) = Trees_NewNode(Trees_Symbol((yyvsp[0].node)), Trees_Left((yyvsp[0].node)), (yyvsp[-1].node));
}
}
-#line 2616 "y.tab.c"
+#line 2619 "y.tab.c"
break;
case 76:
{
(yyval.node) = NULL;
}
-#line 2624 "y.tab.c"
+#line 2627 "y.tab.c"
break;
case 77:
Trees_SetKind(TREES_FIELD_KIND, field);
(yyval.node) = Trees_NewNode('.', field, NULL);
}
-#line 2636 "y.tab.c"
+#line 2639 "y.tab.c"
break;
case 78:
curr = Trees_Right(curr);
} while (curr != NULL);
}
-#line 2658 "y.tab.c"
+#line 2661 "y.tab.c"
break;
case 79:
{
(yyval.node) = Trees_NewNode('^', NULL, NULL);
}
-#line 2666 "y.tab.c"
+#line 2669 "y.tab.c"
break;
case 80:
Trees_ReverseList(&(yyvsp[-1].node)); /*correct order*/
(yyval.node) = Trees_NewNode('(', (yyvsp[-1].node), NULL);
}
-#line 2675 "y.tab.c"
+#line 2678 "y.tab.c"
break;
case 81:
{
(yyval.node) = Trees_NewNode('(', NULL, NULL);
}
-#line 2683 "y.tab.c"
+#line 2686 "y.tab.c"
break;
case 82:
(yyval.node) = Trees_NewNode(TREES_EXP_LIST, (yyvsp[0].node), NULL);
Trees_SetType(Trees_Type((yyvsp[0].node)), (yyval.node));
}
-#line 2692 "y.tab.c"
+#line 2695 "y.tab.c"
break;
case 83:
(yyval.node) = reversedList;
Trees_SetType(Trees_Type((yyvsp[0].node)), (yyval.node));
}
-#line 2704 "y.tab.c"
+#line 2707 "y.tab.c"
break;
case 91:
{
(yyval.node) = NULL;
}
-#line 2712 "y.tab.c"
+#line 2715 "y.tab.c"
break;
case 92:
assert(0);
}
}
-#line 2755 "y.tab.c"
+#line 2758 "y.tab.c"
break;
case 93:
HandleProcedureCall(designator, actualParameters, isFunctionCall, &(yyval.node));
assert((yyval.node) != NULL);
}
-#line 2774 "y.tab.c"
+#line 2777 "y.tab.c"
break;
case 94:
Trees_ReverseList(&(yyvsp[0].node)); /*correct order*/
(yyval.node) = (yyvsp[0].node);
}
-#line 2783 "y.tab.c"
+#line 2786 "y.tab.c"
break;
case 95:
(yyval.node) = Trees_NewNode(TREES_STATEMENT_SEQUENCE, (yyvsp[0].node), NULL);
}
}
-#line 2795 "y.tab.c"
+#line 2798 "y.tab.c"
break;
case 96:
(yyval.node) = (yyvsp[-2].node);
}
}
-#line 2807 "y.tab.c"
+#line 2810 "y.tab.c"
break;
case 97:
(yyval.node) = Trees_NewNode(IF, (yyvsp[-5].node), Trees_NewNode(THEN, (yyvsp[-3].node), (yyval.node)));
}
}
-#line 2831 "y.tab.c"
+#line 2834 "y.tab.c"
break;
case 98:
YYABORT;
}
}
-#line 2845 "y.tab.c"
+#line 2848 "y.tab.c"
break;
case 99:
{
(yyval.node) = Trees_NewNode(ELSIF, (yyvsp[-2].node), Trees_NewNode(THEN, (yyvsp[0].node), (yyvsp[-4].node)));
}
-#line 2853 "y.tab.c"
+#line 2856 "y.tab.c"
break;
case 100:
{
(yyval.node) = NULL;
}
-#line 2861 "y.tab.c"
+#line 2864 "y.tab.c"
break;
case 101:
{
(yyval.node) = Trees_NewNode(ELSE, (yyvsp[0].node), NULL);
}
-#line 2869 "y.tab.c"
+#line 2872 "y.tab.c"
break;
case 102:
{
(yyval.node) = NULL;
}
-#line 2877 "y.tab.c"
+#line 2880 "y.tab.c"
break;
case 103:
}
(yyval.node) = Trees_NewNode(CASE, (yyvsp[-3].node), (yyvsp[-1].node));
}
-#line 2899 "y.tab.c"
+#line 2902 "y.tab.c"
break;
case 104:
YYABORT;
}
}
-#line 2938 "y.tab.c"
+#line 2941 "y.tab.c"
break;
case 105:
(yyval.node) = NULL;
}
}
-#line 2950 "y.tab.c"
+#line 2953 "y.tab.c"
break;
case 106:
(yyval.node) = NULL;
}
}
-#line 2966 "y.tab.c"
+#line 2969 "y.tab.c"
break;
case 107:
Trees_ReverseList(&(yyvsp[-2].node)); /*correct order*/
(yyval.node) = Trees_NewNode(TREES_CASE, (yyvsp[-2].node), (yyvsp[0].node));
}
-#line 2975 "y.tab.c"
+#line 2978 "y.tab.c"
break;
case 108:
{
(yyval.node) = NULL;
}
-#line 2983 "y.tab.c"
+#line 2986 "y.tab.c"
break;
case 109:
{
(yyval.node) = Trees_NewNode(TREES_CASE_LABEL_LIST, (yyvsp[0].node), NULL);
}
-#line 2991 "y.tab.c"
+#line 2994 "y.tab.c"
break;
case 110:
YYABORT;
}
}
-#line 3008 "y.tab.c"
+#line 3011 "y.tab.c"
break;
case 111:
Trees_NewNode(TREES_NOSYM, (yyvsp[0].node), Trees_Left(caseLabelsStack)),
Trees_Right(caseLabelsStack));
}
-#line 3021 "y.tab.c"
+#line 3024 "y.tab.c"
break;
case 112:
Trees_NewNode(TREES_NOSYM, (yyval.node), Trees_Left(caseLabelsStack)),
Trees_Right(caseLabelsStack));
}
-#line 3069 "y.tab.c"
+#line 3072 "y.tab.c"
break;
case 113:
YYABORT;
}
}
-#line 3082 "y.tab.c"
+#line 3085 "y.tab.c"
break;
case 114:
YYABORT;
}
}
-#line 3100 "y.tab.c"
+#line 3103 "y.tab.c"
break;
case 115:
YYABORT;
}
}
-#line 3186 "y.tab.c"
+#line 3189 "y.tab.c"
break;
case 116:
{
(yyval.node) = Trees_NewNode(WHILE, (yyvsp[-4].node), Trees_NewNode(DO, (yyvsp[-2].node), (yyvsp[-1].node)));
}
-#line 3194 "y.tab.c"
+#line 3197 "y.tab.c"
break;
case 117:
{
(yyval.node) = Trees_NewNode(ELSIF, (yyvsp[-2].node), Trees_NewNode(THEN, (yyvsp[0].node), (yyvsp[-4].node)));
}
-#line 3202 "y.tab.c"
+#line 3205 "y.tab.c"
break;
case 118:
{
(yyval.node) = NULL;
}
-#line 3210 "y.tab.c"
+#line 3213 "y.tab.c"
break;
case 119:
YYABORT;
}
}
-#line 3225 "y.tab.c"
+#line 3228 "y.tab.c"
break;
case 120:
(yyvsp[-4].node),
Trees_NewNode(BY, byExp, (yyvsp[-1].node))));
}
-#line 3244 "y.tab.c"
+#line 3247 "y.tab.c"
break;
case 121:
YYABORT;
}
}
-#line 3272 "y.tab.c"
+#line 3275 "y.tab.c"
break;
case 122:
YYABORT;
}
}
-#line 3284 "y.tab.c"
+#line 3287 "y.tab.c"
break;
case 123:
YYABORT;
}
}
-#line 3305 "y.tab.c"
+#line 3308 "y.tab.c"
break;
case 124:
{
(yyval.node) = NULL;
}
-#line 3313 "y.tab.c"
+#line 3316 "y.tab.c"
break;
case 125:
YYABORT;
}
}
-#line 3364 "y.tab.c"
+#line 3367 "y.tab.c"
break;
case 126:
Generate_ProcedureHeading((yyvsp[-1].node));
(yyval.node) = (yyvsp[-1].node);
}
-#line 3386 "y.tab.c"
+#line 3389 "y.tab.c"
break;
case 127:
}
(yyval.node) = (yyvsp[0].node);
}
-#line 3402 "y.tab.c"
+#line 3405 "y.tab.c"
break;
case 128:
{
(yyval.node) = (yyvsp[0].node);
}
-#line 3410 "y.tab.c"
+#line 3413 "y.tab.c"
break;
case 129:
{
(yyval.node) = NULL;
}
-#line 3418 "y.tab.c"
+#line 3421 "y.tab.c"
break;
case 130:
{
(yyval.node) = (yyvsp[0].node);
}
-#line 3426 "y.tab.c"
+#line 3429 "y.tab.c"
break;
case 131:
{
(yyval.node) = NULL;
}
-#line 3434 "y.tab.c"
+#line 3437 "y.tab.c"
break;
case 137:
YYABORT;
}
}
-#line 3449 "y.tab.c"
+#line 3452 "y.tab.c"
break;
case 138:
{
(yyval.node) = NULL;
}
-#line 3457 "y.tab.c"
+#line 3460 "y.tab.c"
break;
case 139:
{
unresolvedPointerTypes = NULL;
}
-#line 3465 "y.tab.c"
+#line 3468 "y.tab.c"
break;
case 148:
{
(yyval.node) = Types_NewProcedure((yyvsp[-2].node), (yyvsp[0].node));
}
-#line 3473 "y.tab.c"
+#line 3476 "y.tab.c"
break;
case 149:
Trees_ReverseList(&(yyvsp[0].node)); /*correct order*/
(yyval.node) = (yyvsp[0].node);
}
-#line 3482 "y.tab.c"
+#line 3485 "y.tab.c"
break;
case 150:
{
(yyval.node) = NULL;
}
-#line 3490 "y.tab.c"
+#line 3493 "y.tab.c"
break;
case 151:
(yyval.node) = (yyvsp[0].node);
Trees_ReverseList(&(yyval.node));
}
-#line 3499 "y.tab.c"
+#line 3502 "y.tab.c"
break;
case 152:
} while (p != NULL);
/*$$ in reversed order*/
}
-#line 3533 "y.tab.c"
+#line 3536 "y.tab.c"
break;
case 153:
YYABORT;
}
}
-#line 3556 "y.tab.c"
+#line 3559 "y.tab.c"
break;
case 154:
{
(yyval.node) = NULL;
}
-#line 3564 "y.tab.c"
+#line 3567 "y.tab.c"
break;
case 155:
(yyval.node) = (yyvsp[-2].node);
}
-#line 3584 "y.tab.c"
+#line 3587 "y.tab.c"
break;
case 156:
{
(yyval.integer) = TREES_VAR_PARAM_KIND;
}
-#line 3592 "y.tab.c"
+#line 3595 "y.tab.c"
break;
case 157:
{
(yyval.integer) = TREES_VALUE_PARAM_KIND;
}
-#line 3600 "y.tab.c"
+#line 3603 "y.tab.c"
break;
case 158:
{
(yyval.node) = Trees_NewNode(TREES_IDENT_LIST, Trees_NewIdent((yyvsp[0].ident)), NULL);
}
-#line 3608 "y.tab.c"
+#line 3611 "y.tab.c"
break;
case 159:
(yyval.node) = Trees_NewNode(TREES_IDENT_LIST, Trees_NewIdent((yyvsp[0].ident)), (yyvsp[-2].node));
}
-#line 3630 "y.tab.c"
+#line 3633 "y.tab.c"
break;
case 160:
exit(EXIT_FAILURE);
}
}
-#line 3647 "y.tab.c"
+#line 3650 "y.tab.c"
break;
case 161:
{
(yyval.node) = Trees_NewNode(ARRAY, NULL, (yyvsp[-2].node));
}
-#line 3655 "y.tab.c"
+#line 3658 "y.tab.c"
break;
case 162:
{
(yyval.node) = NULL;
}
-#line 3663 "y.tab.c"
+#line 3666 "y.tab.c"
break;
case 163:
YYABORT;
}
}
-#line 3690 "y.tab.c"
+#line 3693 "y.tab.c"
break;
case 164:
YYABORT;
}
}
-#line 3705 "y.tab.c"
+#line 3708 "y.tab.c"
break;
case 165:
YYACCEPT;
}
}
-#line 3715 "y.tab.c"
+#line 3718 "y.tab.c"
break;
case 166:
YYACCEPT;
}
}
-#line 3725 "y.tab.c"
+#line 3728 "y.tab.c"
break;
case 167:
}
}
}
-#line 3762 "y.tab.c"
+#line 3765 "y.tab.c"
break;
case 168:
(yyval.node) = NULL;
}
}
-#line 3774 "y.tab.c"
+#line 3777 "y.tab.c"
break;
case 169:
(yyval.node) = (yyvsp[-2].node);
}
}
-#line 3786 "y.tab.c"
+#line 3789 "y.tab.c"
break;
case 170:
YYABORT;
}
}
-#line 3862 "y.tab.c"
+#line 3865 "y.tab.c"
break;
case 171:
{
(yyval.ident) = (yyvsp[0].ident);
}
-#line 3870 "y.tab.c"
+#line 3873 "y.tab.c"
break;
case 172:
{
(yyval.ident) = NULL;
}
-#line 3878 "y.tab.c"
+#line 3881 "y.tab.c"
break;
case 173:
{
Generate_ModuleStatements((yyvsp[0].node));
}
-#line 3886 "y.tab.c"
+#line 3889 "y.tab.c"
break;
-#line 3890 "y.tab.c"
+#line 3893 "y.tab.c"
default: break;
}
break;
}
break;
- case '#':
+ case NOT_EQ:
switch (Trees_Symbol(expA)) {
case TRUE:
case FALSE:
case '=':
result = "=";
break;
- case '#':
+ case NOT_EQ:
result = "#";
break;
case '<':
DOTDOT = 292,
GE = 293,
LE = 294,
- IDENT = 295,
- INTEGER = 296,
- REAL = 297,
- STRING = 298,
- TOKEN_END = 299
+ NOT_EQ = 295,
+ IDENT = 296,
+ INTEGER = 297,
+ REAL = 298,
+ STRING = 299,
+ TOKEN_END = 300
};
#endif
/* Tokens. */
#define DOTDOT 292
#define GE 293
#define LE 294
-#define IDENT 295
-#define INTEGER 296
-#define REAL 297
-#define STRING 298
-#define TOKEN_END 299
+#define NOT_EQ 295
+#define IDENT 296
+#define INTEGER 297
+#define REAL 298
+#define STRING 299
+#define TOKEN_END 300
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
const char *string;
Trees_Node node;
-#line 153 "y.tab.h"
+#line 155 "y.tab.h"
};
typedef union YYSTYPE YYSTYPE;
begin
(*booleans*)
Assert(true = true);
- Assert(true # false);
+ Assert(true != false);
b := true;
b1 := false;
Assert(b = true);
- Assert(b1 # true);
+ Assert(b1 != true);
(*characters / single-character strings*)
ch := 0X;
ch1 := "a";
Assert(ch = 0X);
- Assert(ch # "a");
+ Assert(ch != "a");
Assert(ch < ch1);
Assert(ch <= 0X);
Assert(ch <= "a");
(*integers*)
Assert(0 = 0);
- Assert(0 # 1);
+ Assert(0 != 1);
Assert(0 < 1);
Assert(0 <= 0);
Assert(0 <= 1);
Assert(1 >= 0);
n := 0;
Assert(n = 0);
- Assert(n # 1);
+ Assert(n != 1);
Assert(n < 1);
Assert(n <= 0);
Assert(n <= 1);
(*real numbers*)
Assert(0.0 = 0.0);
- Assert(0.0 # 1.0);
+ Assert(0.0 != 1.0);
Assert(0.0 < 1.0);
Assert(0.0 <= 0.0);
Assert(0.0 <= 1.0);
Assert(1.0 >= 0.0);
x := 0.0;
Assert(x = 0.0);
- Assert(x # 1.0);
+ Assert(x != 1.0);
Assert(x < 1.0);
Assert(x <= 0.0);
Assert(x <= 1.0);
(*strings / characters / character arrays*)
Assert("foo" = "foo");
- Assert("foo" # "bar");
+ Assert("foo" != "bar");
Assert("bar" < "foo");
Assert("foo" <= "foo");
Assert("bar" <= "foo");
Assert("foo" >= "bar");
ch := "b";
Assert("b" = ch);
- Assert("f" # ch);
+ Assert("f" != ch);
Assert(ch < "c");
Assert("b" <= ch);
Assert("a" <= ch);
Assert("c" >= ch);
str := "foo";
Assert("foo" = str);
- Assert("fool" # str);
- Assert("fo" # str);
- Assert("bar" # str);
+ Assert("fool" != str);
+ Assert("fo" != str);
+ Assert("bar" != str);
Assert("bar" < str);
Assert("fo" < str);
Assert("foo" <= str);
strs[0] := "";
strs[1] := "bar";
Assert(~(str = strs[1]));
- Assert(str # strs[1]);
+ Assert(str != strs[1]);
Assert(~(str < strs[1]));
Assert(~(str <= strs[1]));
Assert(str > strs[1]);
Assert(n = -10);
New(v);
- Assert(v # nil);
+ Assert(v != nil);
v.f := 1;
Assert(v.f = 1);
end TestPredeclaredProperProcedures;