SYNTAX ERROR: Difference between revisions

Jump to navigation Jump to search
73 bytes added ,  21:02, 10 September 2022
m
Text replacement - "<source" to "<syntaxhighlight"
(Created page with "A SYNTAX ERROR is an error message which indicates that a rule of APL syntax was violated. A SYNTAX ERROR may indicate an ill-formed expression which violates APL's gr...")
 
m (Text replacement - "<source" to "<syntaxhighlight")
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A SYNTAX ERROR is an [[error message]] which indicates that a rule of [[APL syntax]] was violated. A SYNTAX ERROR may indicate an ill-formed expression which violates APL's grammar:
A SYNTAX ERROR is an [[error message]] which indicates that a rule of [[APL syntax]] was violated. A SYNTAX ERROR may indicate an ill-formed expression which violates APL's grammar:
<source lang=apl>
<syntaxhighlight lang=apl>
       (
       (
SYNTAX ERROR
SYNTAX ERROR
Line 10: Line 10:
       'Hello world
       'Hello world
       ∧
       ∧
</source>
</syntaxhighlight>
However, a SYNTAX ERROR may also indicate a problem not with the sequence of tokens in a statement, but with their meaning. For example, below an error results when a [[function]] is called with invalid [[valence]]: here, a [[monadic function]] with two arguments.
However, a SYNTAX ERROR may also indicate a problem not with the sequence of tokens in a statement, but with their meaning. For example, below an error results when a [[function]] is called with invalid [[valence]]: here, a [[monadic function]] with two arguments.
<source lang=apl>
<syntaxhighlight lang=apl>
       fn ← +
       fn ← +
       2 fn 3
       2 fn 3
Line 21: Line 21:
       2 fn 3
       2 fn 3
         ∧
         ∧
</source>
</syntaxhighlight>
Depending on the value of <source lang=apl inline>fn</source>, the same statement may or may not be considered invalid syntax. This is to be expected, since APL does not have a [[wikipedia:context-free grammar|context-free grammar]] and needs to know the type of each variable to parse a statement.
Depending on the value of <syntaxhighlight lang=apl inline>fn</syntaxhighlight>, the same statement may or may not be considered invalid syntax. This is to be expected, since APL does not have a [[wikipedia:context-free grammar|context-free grammar]] and needs to know the type of each variable to parse a statement.


{{APL features}}
{{APL features}}[[Category:Errors]]

Navigation menu