help-octave
[Top][All Lists]
Advanced

[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

Hello,
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
if(1==0)
<tmp.m>
end

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

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 
(http://www.gnu.org/software/octave/doc/interpreter/Grammar.html#Grammar) saying
"Someday I hope to expand this to include a semi-formal description of Octave's 
language."

Thanks
Tino
_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192



reply via email to

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