On Tue, 28 Nov 2000, Justin Case wrote:
> Julian Monteiro wrote:
> > I'm trying do make a Robot which interpretate Javascript pages.
>
> HTML is a STRUCTURAL language. It describes the STRUCTURE of a document. A robot
> can analyze and validate the structure to see if it conforms to the rules of the
> language. It can also extract "meaning" (e.g. a link) from the document because
> the structure defines what the parts "mean".
>
> JavaScript (and Java) are PROCEDURAL languages. They can make branching
> decisions and execute loops. A robot could validate the syntax of the language,
> but to find out what it "means" (e.g. to extract links for a spider) the robot
That's it. I'm trying to make a Robot who evaluate the Javascript
code, like most modern browsers, the mozilla SpiderMonkey can do that, no?
> would have to execute or emulate the instructions. In other words, a badly coded
> web page could put your robot into an infinite loop.
Yes..
>
> Also, for your robot to fully examine the "meaning" of the program, it would
> have to follow BOTH SIDES of each branch in the logic, to see where it leads.
> This quickly creates a nearly infinite group of permutations in all but the
> simplest programs.
>
> Anyone intending to develop (or ask someone else to develop) a JavaScript
> "interpretater" needs to consider these issues and realize that reliably
> extracting the "meaning" from program source code is a computationally
> prohibitive task.
>
> To put it another way, a compiler can identify syntax errors in a program. So
> could a robot. But to find logic errors (or the outcome of correct logic) you
> have to actually run the code.
>
> So what is it you want this "interpretater" to produce?
>