Back: 1.3.6 Shell commands, removing and renaming files Forward: 1.3.7.1 Runtime errors     FastBack: 1. Basic Ideas Up: 1.3 The Interpreted Environment FastForward: 2. Using Array Syntax         Top: Yorick: An Interpreted Language Contents: Table of Contents     About: About This Document

1.3.7 Error Messages

When Yorick cannot decipher the meaning of a statement, you have made a syntax error. Syntax errors are mostly simple typos, but a mechanical language like Yorick can be exasperatingly picky:

 
> th= span(0,2*pi,200)
> for (i=1 ; i<=5 ; ++i) { r=cos(i*th); plg,r*sin(th),r*cos(th) }
SYNTAX: parse error near }
>

The only mistake here is that Yorick wants a semicolon (or newline) before the close curly brace completing a compound statement. If you think “fixing” this type of behavior would be simple, I suggest you study parsers. Every programming language has its quirks.

When Yorick detects a syntax error, the error message always begins with SYNTAX:. The entire block containing the error will be discarded; no statements will be executed which might lead to the execution of the statement containing the error. If the error is in a function body, the function will not be defined. However, if the sytax error occurs reading an include file, Yorick continues to parse the file looking for additional syntax errors. After about a dozen syntax errors in a single file, Yorick gives up and waits for keyboard input. Therefore, you may be able to repair several syntax errors before you re-include the file.

All other errors are runtime errors.


Back: 1.3.6 Shell commands, removing and renaming files Forward: 1.3.7.1 Runtime errors     FastBack: 1. Basic Ideas Up: 1.3 The Interpreted Environment FastForward: 2. Using Array Syntax         Top: Yorick: An Interpreted Language Contents: Table of Contents     About: About This Document