Skip to Content.
Sympa Menu

k-user - Re: [K-user] Precedences

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] Precedences


Chronological Thread 
  • From: Radu Mereuta <headness13 AT gmail.com>
  • To: Andreas Zwinkau <zwinkau AT kit.edu>
  • Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] Precedences
  • Date: Fri, 7 Jun 2013 16:25:21 +0300
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

Hi Andreas,

The K-primer is outdated. Since then we switched from the maude parser which used precedence annotations, to priorities used in SDF (Syntax Definition Formalism).

The PDFs are not exact, they offer a high level overview of a definition (we made it look better on posters).

There are two ways of setting precedences now:
1. in the syntax blocks like you just did
2. with a special declaration:
syntax priorities '_*_ > '_+_


Radu
K developer


On Fri, Jun 7, 2013 at 3:42 PM, Andreas Zwinkau <zwinkau AT kit.edu> wrote:
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


_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user




  • [K-user] Precedences, Andreas Zwinkau, 06/07/2013
    • Re: [K-user] Precedences, Radu Mereuta, 06/07/2013

Archive powered by MHonArc 2.6.16.

Top of Page