Closed teto1992 closed 9 years ago
the problem is the 'return' inside a main function. Because, from the point of view of semantic rules, this kind of statement is not implemented for main function.
Anyway now the parser manages this kind of problems
I wrote the funW@P code for the Fibonacci sequence as:
fun fib(n int) int{ var retVal int = -1; if n == 0 { retVal = 0; } if n == 1 { retVal = 1; } else { retVal = (fib(n-1) + fib(n-2)); } return retVal; }
fun main(){ return fib(5); }
Unfortunately the parsing doesn't produce any result and throws an Exception which is not handled. Any idea? Is my syntax OK?