On 2-Jun-08, at 2:05 PM, Catherine Gaudron wrote:
If I remember correctly, the code works under Safari and Opera (never tested it on IE). After some testing I was able to compile simple things such as (display "hello") by removing the compiler from the run-time, but anything more complicated then a simple display will give the too much recursion error.
Catherine
The problem appears to be that the Firefox JavaScript parser is overflowing the ***compiler's*** stack. I verified this with the code below.
So one idea would be to modify the JavaScript code generator to flatten the code. I'm not sure how easy this is... it requires a kind of lambda lifting of the code.
I'll look into it.
Marc
<script language="JavaScript">
function f(x) { return x+1 }
// This expression works as expected: alert(f(f(f(f(0)))))
// The following expression gives a "too much recursion" error. // There is no "recursion" at run time, but possibly some at compile time. // A better error message would be "too much syntactic nesting". It // is probable that the Firefox JavaScript front-end (i.e. parser) is // written in JavaScript and uses recursion, so the JavaScript runtime // system detects a stack overflow while parsing/compiling the code. // On Firefox 1.5.0.1 the maximal nesting of calls to f seems to be 344 // which is not much...
alert( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( 0 ))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )
</script>