k-user AT lists.siebelschool.illinois.edu
Subject: K-user mailing list
List archive
- From: Andrei Arusoaie <andrei.arusoaie AT gmail.com>
- To: "Seyed H. HAERI (Hossein)" <hossein.haeri AT gmail.com>
- Cc: k-user AT cs.uiuc.edu
- Subject: Re: [K-user] Failed to kompile Fig 3 of K Primer
- Date: Mon, 20 Feb 2012 15:16:36 +0200
- Authentication-results: mr.google.com; spf=pass (google.com: domain of andrei.arusoaie AT gmail.com designates 10.180.92.229 as permitted sender) smtp.mail=andrei.arusoaie AT gmail.com; dkim=pass header.i=andrei.arusoaie AT gmail.com
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user>
- List-id: <k-user.cs.uiuc.edu>
Hi Seyed,
Because we rely on Maude parsing, which is not necessarily the best choice, sometimes we get into this kind of errors...
What you can do is to add precedences to you syntactical constructs.
For instance, this is how it worked for me:
mac:exp andreiarusoaie$ cat exp-lambda.k
require exp
require /modules/substitution
module EXP-LAMBDA-SYNTAX
imports EXP-SYNTAX
syntax Val ::= #Int
| "lambda" #Id "." Exp [binder prec 50]
syntax Exp ::= Val
| Exp Exp [seqstrict prec 60]
| "mu" #Id "." Exp [binder]
syntax Exp ::= "let" #Id "=" Exp "in" Exp
| "letrec" #Id #Id "=" Exp "in" Exp
macro (let X:#Id = E1:Exp in E2:Exp) = (lambda X.E2) E1
end module
module EXP-LAMBDA
end module
mac:exp andreiarusoaie$ kompile exp-lambda.k
Compiled version written in exp-lambda-compiled.maude.
mac:exp andreiarusoaie$
Notice that I've added the `prec` attribute to 'ambiguous' constructs: `"lambda" #Id "." Exp` and `Exp Exp` . `prec 50` says that `"lambda" #Id "." Exp` construct should be applied first, before any construct which has prec Y, where Y > 50. This is the reason I've added `prec 60` to `Exp Exp`.
Maybe our Maude expert, Traian, will come with a nicer solution. :-)
Andrei
2012/2/20 Seyed H. HAERI (Hossein) <hossein.haeri AT gmail.com>
Hi again,
Now, I have a new error message
<Err>
Error: "exp-lambda.maude", line 317 (mod EXP-LAMBDA-SYNTAX): didn't expect
to...
eq ( let X:#Id = E1:Exp in E2:Exp ) = ( lambda X . E2 ) <---*HERE*
Error: "exp-lambda.maude", line 316 (mod EXP-LAMBDA-SYNTAX): no parse for
st...
eq (let X:#Id = E1:Exp in E2:Exp) = (lambda X . E2) E1 [metadata
"location=(...
</Err>
for this bit of Fig 3:
<Code>
require exp
require /modules/substitution
module EXP-LAMBDA-SYNTAX
imports EXP-SYNTAX
syntax Val ::= #Int
| "lambda" #Id "." Exp [binder]
syntax Exp ::= Val
| Exp Exp [seqstrict]
| "mu" #Id "." Exp [binder]
syntax Exp ::= "let" #Id "=" Exp "in" Exp
| "letrec" #Id #Id "=" Exp "in" Exp
macro (let X:#Id = E1:Exp in E2:Exp) =
(lambda X.E2) E1
end module
module EXP-LAMBDA
end module
</Code>
I can't quite get it why Maude is unhappy with the parenthesisation. Any idea?
TIA,
--Hossein
--------------------------------------------------------------------------------------------------------------
Seyed H. HAERI (Hossein)
Research Assistant
Institute for Software Systems (STS)
Technical University of Hamburg (TUHH)
Hamburg, Germany
ACCU - Professionalism in programming - http://www.accu.org/
--------------------------------------------------------------------------------------------------------------
_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user
Numai bine,
Andrei
- [K-user] Failed to kompile Fig 3 of K Primer, Seyed H. HAERI (Hossein), 02/19/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Andrei Arusoaie, 02/19/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Seyed H. HAERI (Hossein), 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Seyed H. HAERI (Hossein), 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Andrei Arusoaie, 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Moore, Brandon Michael, 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Seyed H. HAERI (Hossein), 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Seyed H. HAERI (Hossein), 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Moore, Brandon Michael, 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Andrei Arusoaie, 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Seyed H. HAERI (Hossein), 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Seyed H. HAERI (Hossein), 02/20/2012
- Re: [K-user] Failed to kompile Fig 3 of K Primer, Andrei Arusoaie, 02/19/2012
Archive powered by MHonArc 2.6.16.