tiger language manual: misc: wrapping, styling

* source/reference_manual/tiger_language_reference_manual/lexical_specifications/lexical_specifications.rst,
* source/reference_manual/tiger_language_reference_manual/semantics/declarations/declarations.rst,
* source/reference_manual/tiger_language_reference_manual/semantics/declarations/declarations/import,
* source/reference_manual/tiger_language_reference_manual/semantics/declarations/function_declarations/function_declarations.rst,
* source/reference_manual/tiger_language_reference_manual/semantics/declarations/method_declarations/method_declarations.rst,
* source/reference_manual/tiger_language_reference_manual/semantics/declarations/type_declarations/classes3,
* source/reference_manual/tiger_language_reference_manual/semantics/declarations/type_declarations/type_declarations.rst,
* source/reference_manual/tiger_language_reference_manual/semantics/declarations/variable_declarations/variable_declarations.rst,
* source/reference_manual/tiger_language_reference_manual/semantics/expressions/expressions.rst: Here.
parent 0a2fc082
Pipeline #18122 passed with stage
in 1 minute and 22 seconds
......@@ -35,7 +35,7 @@ Strings
following escapes:
``\a``, ``\b``, ``\f``, ``\n``, ``\r``, ``\t``, ``\v``
control characters.
Control characters.
``\num``
The character which code is ``num`` in octal. Valid character codes belong
......
......@@ -4,13 +4,15 @@ Declarations
------------
import
An import clause denote the same expression where it was (recursively)
replaced by the set of declarations its corresponding import-file contains.
:code:`import`
An :code:`import` clause denote the same expression where it was
(recursively) replaced by the set of declarations its corresponding
import-file contains.
An import-file has the following syntax
(see :ref:`Syntactic Specifications` for the definition of the symbols):
.. literalinclude:: declarations/import
:language: ebnf
Because the syntax is different, it is convenient to use another extension.
We use ``*.tih`` for files to import, for instance:
......@@ -45,7 +47,7 @@ import
in the current directory, then in all the directories of the include path,
in order.
name spaces
Name spaces
There are three name spaces: types, variables and functions. The original
language definition features two: variables and functions share the same
name space. The motivation, as noted by Sébastien Carlier, is that in
......
......@@ -4,7 +4,7 @@ Function Declarations
=====================
functions
Functions
To declare a function, provide its return value type:
.. literalinclude:: function.tig
......@@ -15,24 +15,24 @@ functions
.. literalinclude:: procedure.tig
:language: tiger
Functions can be recursive, but mutually recursive functions must be in the
same sequence of function declarations (no other declaration should be
placed between them).
Functions can be recursive, but mutually recursive functions must be
in the same sequence of function declarations (no other declaration
should be placed between them).
See the semantics of function calls for the argument passing policy
(see :ref:`Expressions`).
primitive
A primitive is a built-in function, i.e. a function which body is provided
by the runtime system.
Primitives
A primitive is a built-in function, i.e. a function which body is
provided by the runtime system.
See :ref:`Predefined Functions` for the list of standard primitives.
Aside from the lack of body, and henceforth the absence of translation,
primitive declarations behave as function declarations. They share the same
name space, and obey the same duplicate-name rule. For instance:
primitive declarations behave as function declarations. They share the
same name space, and obey the same duplicate-name rule. For instance:
.. literalinclude:: primitive.tig
:language: tiger
is invalid, and must be rejected with exit status set to 4.
is invalid and must be rejected with the exit status set to 4.
......@@ -5,28 +5,29 @@ Method Declarations
Overriding methods
When a method in a class overrides a method of a super class, the overridden
method (in the super class) is no longer accessible. Dynamic dispatch is
performed, using the exact type of the object (known at run time) to select
the method according to this exact type.
When a method in a class overrides a method of a super class, the
overridden method in the super class is no longer accessible.
Dynamic dispatch is performed, using the exact type of the object
(known at runtime) to select the method according to this exact type.
However, the interface of the accessible attributes and callable methods
remains restricted to the static interface
(i.e. the one of the static type of the object).
However, the interface of the accessible attributes and callable
methods remains restricted to the static interface (i.e. the one
of the static type of the object).
.. literalinclude:: overriding.tig
:language: tiger
Method invariance
Methods are invariant in Tiger: each redefinition of a method in a subclass
shall have the exact same signature as the original (overridden) method.
Methods are invariant in Tiger: each redefinition of a method in
a subclass shall have the exact same signature as the original
overridden method.
This invariance applies to:
1. the number of arguments.
2. the types of the arguments.
3. the type of the return value (2).
3. the type of the return value [#]_.
.. literalinclude:: invariance.tig
:language: tiger
*(2) Which is not the case in C++, where methods have covariant return values.*
.. [#] Which is not the case in C++, where methods have covariant return values.
class Name [ extends Super ] { Classfields }
=> type Name = class [ extends Super ] { Classfields }
class name [ extends super ] { classfields }
=> type name = class [ extends super ] { classfields }
......@@ -4,19 +4,19 @@ Variable Declarations
=====================
variables
Variables
There are two forms of variable declarations in Tiger:
the short one and the long one.
In the short form, only the name of the variable and the initial value of
the variable are specified, the variable type is “inferred”.
In the short form, only the name of the variable and the initial
value of the variable are specified, the variable type is *inferred*.
.. literalinclude:: variables.tig
:language: tiger
In the long form, the type of the variable is specified.
Since one cannot infer a record type for nil, the long form is mandated
when declaring a variable initialized to nil.
Since one cannot infer a record type for :code:`nil`, the long form
is mandated when declaring a variable initialized to :code:`nil`.
.. literalinclude:: variables2.tig
:language: tiger
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment