google-code-export / omega

Automatically exported from code.google.com/p/omega
Other
2 stars 0 forks source link

Unknown Var at level 0 bind #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
load 
<http://svn.berlios.de/viewcvs/al4nin/trunk/found-bugs/issue20-ThristParser.omg?
rev=418&view=markup>

and on the console enter

prompt> (run (compileParse [Wrap [Atom 'a']l]l)) 'g'
Unknown Var at level 0: bind

it is because of this code:

compileParse [Wrap thr; r]l = [| \a -> do { a' <- $(compileParse thr) a; 
$parseR a' } |]
    where monad maybeM
      parseR = compileParse r

If I change it to read

compileParse [Wrap thr; r]l = [| \a -> let monad maybeM in do { a' <- 
$(compileParse thr) a; 
$parseR a' } |]
    where parseR = compileParse r

it works.

I suspect, that the bindings established by the where clause outside are not 
properly recorded in 
the "do" sugar inside of Code brackets.

Original issue reported on code.google.com by ggr...@gmail.com on 12 Jul 2007 at 12:53

GoogleCodeExporter commented 9 years ago
problem still persists, but I get

The data decl: Token has a contructor named 'L' or 'R'.
These names are reserved for the sum type. L:: a -> (a+b), R:: b -> (a+b)

when loading that file.

Original comment by ggr...@gmail.com on 9 Nov 2007 at 7:05

GoogleCodeExporter commented 9 years ago
test file fixed

Original comment by ggr...@gmail.com on 18 Nov 2007 at 6:36

GoogleCodeExporter commented 9 years ago

Original comment by ggr...@gmail.com on 10 Jan 2011 at 3:52

GoogleCodeExporter commented 9 years ago
Looks like the 'Exp' constructor 'Do' is special cased in many places to always 
access the global 'bind' and 'fail'.

I believe this is wrong.

We should record the current expressions for 'bind' and 'fail' in 'Do' and 
bring them into scope like with a 'Let' inside. Also this makes it much easier 
to deal with situations when we go under brackets.

        vvvvvvvv
  | Do (Exp, Exp) [Stmt Pat Exp Dec]     -- { do { p <- e1; e2 }  }

Original comment by ggr...@gmail.com on 10 Jan 2011 at 5:12

GoogleCodeExporter commented 9 years ago
As of r552 we have a functional implementation of this issue on 
branches/issue-20.
The 2 remaining FIXMEs (1 x Infer.hs and 2 x LangEval.hs) may be deferred to 
later.

Original comment by ggr...@gmail.com on 11 Jan 2011 at 12:05

GoogleCodeExporter commented 9 years ago
As of r563, only one FIXME (in Infer.hs) remains. But that is not a regression, 
and I have not succeeded to create a snippet that would exhibit a problem with 
the current approach. If we are lucky, we do not have to check the (bind,infer) 
from the 'Do' at all, and checking the in-scope (Global "bind", Global "fail") 
suffices.

Original comment by ggr...@gmail.com on 11 Jan 2011 at 11:53

GoogleCodeExporter commented 9 years ago
Merged from branch as r566.

Original comment by ggr...@gmail.com on 11 Jan 2011 at 12:50