k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: Rikard Hjort <benparad AT hotmail.com>
- To: "isaacdefrain AT gmail.com" <isaacdefrain AT gmail.com>, "k-user AT lists.cs.illinois.edu" <k-user AT lists.cs.illinois.edu>
- Subject: Re: [[K-user] ] CellBags & Functions
- Date: Fri, 18 Oct 2019 14:01:18 +0000
- Accept-language: sv-SE, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VXdc1fb4TEsnpugKs/8/5zOCDGyDimmp3pMsPXFgpWk=; b=Q/hhLWv09XsVqnVefCTwdO1mxlk3LPCJ8mZm9kgejk/imxNU3+f/SBSB/iGMefYNg7xBvq4k2GX5xlYSpSPp4Iocaxt9JacP5nmyVEhoqItDwXBF88lU4lHyKpEb33Nsgb8skQuJFbGvi9mJXfRxvr2mQhMX6Zu8CN+hVWZ6otdTUu+t9/Mxs79MjCjyl4NLrFvn/NmsMDi7YfHymml1GYtrm7JDa1p9pA5vXjUYxwNcRJxoyhO4bvn0oAsEhESZJ+/Jc2z5uB2NkppJWWjKwEsxm5qNWXUtUQzjnhcWss4Vn7RkSYLIzgHcvDZhVSRgoh/G1C0CV9tp8ZT94+Uqfg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PJpQyKsC9DLOlGTOrdvVlgdHxDtHnI5zr8SjyMPEtPuxnXfyGHMbtGwOPh2s/IRq6RMH2Is1obyOwOaM0COt2G1RQX0yatSwLqyUrVCQIkCEuepMkmgNNTx+iwGdOSKsS77fRqZOeAEhbl7nLPaDkhojWVyX3Bk6q+yfjsP1ipq2sssOWvRqOPCEwUjG/Hsn3ix+ijf8qpA21d+ldyE5Uh3MjoTE/glcZsRJO8pGXZqPiVBPRur18aMLmKucXh3cm97zBBSDeChbih5taMjBnEMCNIxXto2N+RhaWlwswD9VTVkCTT4mNHeHWCOJeF+FJ6kqdZ30bZZkdNxZAoj3UQ==
- Authentication-results: illinois.edu; spf=pass smtp.mailfrom=benparad AT hotmail.com; dkim=pass header.d=hotmail.com header.s=selector1; dmarc=pass header.from=hotmail.com
What is the compiler saying? What's the output?
On 10/17/19 10:50 PM,
isaacdefrain AT gmail.com
wrote:
> Hello and good day,
>
> I asked before, but did not get a response so I'm trying again :-)
>
> I'm defining a programming language whose configuration has multiple cells
> with multiplicity="*", some of which are nested in cells also with
> multiplicity="*"; e.g. something like
>
> module MOD-SYNTAX
> syntax Term ::= "Stop" | Bool | Int | String | "[" Terms "]" // the
> exact
> definition is
> not important
> syntax Terms ::= Term > Term "," Term [right]
> endmodule
>
> endmodule
>
> module MOD
> configuration
> <T>
> <k> $PGM:Term </k>
> <one>
> <alpha multiplicity="*"> .K </alpha>
> </one>
> <two>
> <beta multiplicity="*">
> <gamma>
> <delta multiplicity="*"> .K </delta>
> </gamma>
> </beta>
> </two>
> </T>
>
> // a bunch of semantic rules
> endmodule
>
> I'd like to define two kinds of functions: the first from Terms to
> DeltaCellBag;
> the second from AlphaCellBag to Terms. So in the MOD module, I have
> something
> like
>
> syntax AlphaCellBag
> syntax DeltaCellBag
> syntax DeltaCellBag ::= "fun1(" Terms ")" [function]
> syntax Terms ::= "fun2(" AlphaCellBag ")" [function]
>
> rule fun1( A:Term ) => <delta> A </delta>
> rule fun1( A:Term , B:Terms ) => <delta> A </delta> fun1(B)
>
> rule fun2( .AlphaCellBag ) => Stop
> rule fun2( <alpha> A:Term </alpha> ) => A
> rule fun2( <alpha> A:Term </alpha> B:AlphaCellBag ) => A , fun2(B)
>
> But the compiler complains about the second rule for fun1 and the third rule
> for fun2 (I'm using RV-K version 1.0-SNAPSHOT
> Git revision: 1e310cd
> Git branch: UNKNOWN
> Build date: Thu Jan 31 03:38:17 EST 2019)
>
> It's not clear to me why this is an error. Can someone help me understand
> why
> this error occurs and whether there is a way to define such functions
> (without
> errors)?
>
> Thank you!
- [[K-user] ] CellBags & Functions, isaacdefrain, 10/17/2019
- Re: [[K-user] ] CellBags & Functions, Rikard Hjort, 10/18/2019
Archive powered by MHonArc 2.6.19.