k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: Andreas Zwinkau <zwinkau AT kit.edu>
- To: k-user AT cs.uiuc.edu
- Subject: [K-user] Precedences
- Date: Fri, 07 Jun 2013 14:42:38 +0200
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
In the tutorial precedences are introduced for arithmetic expressions:
syntax Exp ::= Exp "*" Exp [strict,left]
| Exp "/" Exp [strict]
> Exp "+" Exp [strict,left]
> Exp "<=" Exp [strict]
However, I wonder how those mix with the extension of syntax. For
example, is it equivalent to the following?
syntax Exp ::= Exp "*" Exp [strict,left]
| Exp "/" Exp [strict]
> Exp "+" Exp [strict,left]
syntax Exp ::= Exp "<=" Exp [strict]
As far as I understand "The K-Primer", I could set precedences
numerically like the following?
syntax Exp ::= Exp "*" Exp [strict,left,prec(0)]
| Exp "/" Exp [strict,prec(0)]
| Exp "+" Exp [strict,left,prec(1)]
| Exp "<=" Exp [strict,prec(2)]
With the current K-stable, I get some ambiguity warnings for the program
"1*1+1*1". There should be no ambiguity given precedences?
Also, for the pdf-export the ">" operator is replaced with "|", which
means precedence information is missing.
--
Andreas Zwinkau
Karlsruhe Institute of Technology (KIT)
Phone: +4972160848351
Email:
zwinkau AT kit.edu
Web: http://pp.info.uni-karlsruhe.de/personhp/andreas_zwinkau.php
Attachment:
signature.asc
Description: OpenPGP digital signature
- [K-user] Precedences, Andreas Zwinkau, 06/07/2013
- Re: [K-user] Precedences, Radu Mereuta, 06/07/2013
Archive powered by MHonArc 2.6.16.