yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

Back: Shell commands Forward: Runtime errors   FastBack: Flow control Up: Environment FastForward: Arrays         Top: Yorick Contents: Table of Contents Index: Concept Index 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.

1.3.7.1 Runtime errors  
1.3.7.2 How to respond to a runtime error