[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"dangling else" in SDF
- To: centaur@mirsa.inria.fr
- Subject: "dangling else" in SDF
- From: civilare@udc.es (Manuel Vilares Ferro)
- Date: 1 Oct 92 18:46:02 GMT
- X400-Received: by /PRMD=inria/ADMD=atlas/C=FR/;Relayed; 01 Oct 92 19:52:45+0100
- X400-Received: by /PRMD=cicb/ADMD=atlas/C=FR/;Relayed; 01 Oct 92 19:50:21+0100
- X400-Received: by /PRMD=iris/ADMD=mensatex/C=es/;Relayed; 01 Oct 92 19:46:02+0100
We work with CENTAUR version 1.1 and we have tried to implement the
"dangling else" using your formalism SDF version 1.9. In particular we
have described a small language "If" as follows:
------------------------------------
module If
sorts ID STAT
lexical syntax
[a-z]+ -> ID
[ \n] -> LAYOUT
context-free syntax
if ID then STAT -> STAT
if ID then STAT else STAT -> STAT
stat -> STAT
------------------------------------
which presents an evident shift-reduce conflict, but when we try to
analyze the following input
------------------------------------
if a then if b then if c then stat else stat else stat
------------------------------------
there is not such a conflict ?????????. In relation to this, we have
two questions:
1. What is the reason, if you use an LR(0) automaton ?
2. How can I do to implement the "dangling else" ?
Thanks
Manuel Vilares
--------------