[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

syntax check without executing script

From: Tino Scherrer
Subject: syntax check without executing script
Date: Fri, 23 Mar 2007 23:19:35 +0100

I'd like to run a syntax check on a function or a script file without executing 
this file for two reasons.

First, if a file is executed, the interpreter returns after hitting the first 
error in the code. This requires several run-edit-run-edit...-cycles for 
correcting a number of errors that could be removed with a single editing if 
all problems in the code were shown at once.
Second, I could imagine that the interpreter doesn't read certain lines of the 
code because a script returns before reaching those lines. But with different 
user input those lines might be read and cause an error that could have easily 
be detected by a complete syntax check.

Is such a syntax check possible?

My idea was to enclose the script, name it tmp.m like

to make sure that everything until "end" is read, but not executed. However, if 
tmp.m looks like this, the error is not found:
function y=tmp()
s1="Error: ;

If such a syntax check is not possible with octave, my next question would be 
if there is a syntax definition available, so that it could be done using 
bison. All I found is a sentence in the Manual 
( saying
"Someday I hope to expand this to include a semi-formal description of Octave's 

SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]