darcs patch: bugfix: allow multi-word token-type usin... (and 2 more)

Isaac Dupree isaacdupree at charter.net
Thu Dec 27 17:57:12 EST 2007


THIS IS NOT A GHC PATCH, it's a patch for Happy that I didn't know where 
else to send.  I still have no idea where to discuss Happy and Alex 
modifications (things get lost too easily in haskell-cafe, and Happy and 
Alex aren't exactly libraries?); (and I don't know if I should consider 
myself to have commit privileges to them either, when my patches aren't 
ones that need review)

Anyway, these patches were needed for GHC to compile itself using 
`happy`-without-`-agc`, and without indiscriminately enabling 
-fglasgow-exts for the following compilation.


Thu Dec 27 07:57:38 EST 2007  Isaac Dupree <id at isaac.cedarswampstudios.org>
   * bugfix: allow multi-word token-type using parentheses everywhere needed

Thu Dec 27 11:54:46 EST 2007  Isaac Dupree <id at isaac.cedarswampstudios.org>
   * refactor HappyReduction-generating code (no semantic change)

Thu Dec 27 12:04:54 EST 2007  Isaac Dupree <id at isaac.cedarswampstudios.org>
   * self-expand HappyReduction for more Haskell98 compliance
   It's not too bad at all since it's only duplicated in two
   places.  Happy without -agc is most likely to be used by
   the compilers other than GHC anyway.  Should I really
   put those comments into the output file, or is it better
   just to remove the references to the old type-synonym?
-------------- next part --------------
To: cvs-ghc at haskell.org
From: Isaac Dupree <id at isaac.cedarswampstudios.org>
Subject: darcs patch: bugfix: allow multi-word token-type usin... (and 2 more)
X-Mail-Originator: Darcs Version Control System
X-Darcs-Version: 1.0.9 (release)
DarcsURL: http://darcs.haskell.org/happy
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=_"

--=_
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Thu Dec 27 07:57:38 EST 2007  Isaac Dupree <id at isaac.cedarswampstudios.org>
  * bugfix: allow multi-word token-type using parentheses everywhere needed

Thu Dec 27 11:54:46 EST 2007  Isaac Dupree <id at isaac.cedarswampstudios.org>
  * refactor HappyReduction-generating code (no semantic change)

Thu Dec 27 12:04:54 EST 2007  Isaac Dupree <id at isaac.cedarswampstudios.org>
  * self-expand HappyReduction for more Haskell98 compliance
  It's not too bad at all since it's only duplicated in two
  places.  Happy without -agc is most likely to be used by
  the compilers other than GHC anyway.  Should I really
  put those comments into the output file, or is it better
  just to remove the references to the old type-synonym?

--=_
Content-Type: text/x-darcs-patch; name="bugfix_-allow-multi_word-token_type-using-parentheses-everywhere-needed.dpatch"
Content-Transfer-Encoding: quoted-printable
Content-Description: A darcs patch for your repository!


New patches:

[bugfix: allow multi-word token-type using parentheses everywhere needed
Isaac Dupree <id at isaac.cedarswampstudios.org>**20071227125738] {
hunk ./src/ProduceCode.lhs 85
+>    token =3D brack token_type
hunk ./src/ProduceCode.lhs 148
->	  . str "happyInTok :: " . str token_type . str " -> " . bhappy_item
+>	  . str "happyInTok :: " . token . str " -> " . bhappy_item
hunk ./src/ProduceCode.lhs 151
->	  . str "happyOutTok :: " . bhappy_item . str " -> " . str token_type
+>	  . str "happyOutTok :: " . bhappy_item . str " -> " . token
hunk ./src/ProduceCode.lhs 177
->	. str "\n\t=3D HappyTerminal " . str token_type
+>	. str "\n\t=3D HappyTerminal " . token
hunk ./src/ProduceCode.lhs 232
->	      token =3D brack token_type
hunk ./src/ProduceCode.lhs 707
->		 . str token_type
+>		 . token
hunk ./src/ProduceCode.lhs 720
->				         . str token_type . str " -> " =

+>				         . token . str " -> " =

}

[refactor HappyReduction-generating code (no semantic change)
Isaac Dupree <id at isaac.cedarswampstudios.org>**20071227165446] {
hunk ./src/ProduceCode.lhs 201
->       str "type HappyReduction m =3D \n\t"
->     . str "   "
->     . intMaybeHash
->     . str " \n\t-> " . token
->     . str "\n\t-> HappyState "
->     . token
->     . str " (HappyStk HappyAbsSyn -> " . tokens . result
->     . str ")\n\t"
->     . str "-> [HappyState "
->     . token
->     . str " (HappyStk HappyAbsSyn -> " . tokens . result
->     . str ")] \n\t-> HappyStk HappyAbsSyn \n\t-> "
->     . tokens
->     . result
->     . str "\n\n"
+>       happyReductionDefinition . str "\n\n"
hunk ./src/ProduceCode.lhs 206
->     . intMaybeHash
->     . str " -> HappyReduction (" . str monad_tycon . str ")\n\n"
+>     . intMaybeHash . str " -> " . happyReductionValue . str "\n\n"
hunk ./src/ProduceCode.lhs 211
->     . str " :: " . str monad_context . str " =3D> HappyReduction (" . st=
r monad_tycon . str ")\n\n" =

+>     . str " :: " . str monad_context . str " =3D> "
+>     . happyReductionValue . str "\n\n"
hunk ./src/ProduceCode.lhs 222
->	      result =3D (str "m HappyAbsSyn")
+>	      happyReductionDefinition =3D
+>		       str "type HappyReduction m =3D "
+>		     . happyReduction (str "m")
+>	      happyReductionValue =3D
+>		       str "HappyReduction "
+>		     . brack monad_tycon
+>	      happyReduction m =3D
+>		       str "\n\t   "
+>		     . intMaybeHash
+>		     . str " \n\t-> " . token
+>		     . str "\n\t-> HappyState "
+>		     . token
+>		     . str " (HappyStk HappyAbsSyn -> " . tokens . result
+>		     . str ")\n\t"
+>		     . str "-> [HappyState "
+>		     . token
+>		     . str " (HappyStk HappyAbsSyn -> " . tokens . result
+>		     . str ")] \n\t-> HappyStk HappyAbsSyn \n\t-> "
+>		     . tokens
+>		     . result
+>		  where result =3D m . str " HappyAbsSyn"
}

[self-expand HappyReduction for more Haskell98 compliance
Isaac Dupree <id at isaac.cedarswampstudios.org>**20071227170454
 It's not too bad at all since it's only duplicated in two
 places.  Happy without -agc is most likely to be used by
 the compilers other than GHC anyway.  Should I really
 put those comments into the output file, or is it better
 just to remove the references to the old type-synonym?
] {
hunk ./src/ProduceCode.lhs 223
->		       str "type HappyReduction m =3D "
+>		       str "{- to allow type-synonyms as our monads (likely\n"
+>		     . str " - with explicitly-specified bind and return)\n"
+>		     . str " - in Haskell98, it seems that with\n"
+>		     . str " - /type M a =3D .../, then /(HappyReduction M)/\n"
+>		     . str " - is not allowed.  But Happy is a\n"
+>		     . str " - code-generator that can just substitute it.\n"
+>		     . str "type HappyReduction m =3D "
hunk ./src/ProduceCode.lhs 231
+>		     . str "\n-}"
hunk ./src/ProduceCode.lhs 233
->		       str "HappyReduction "
+>		       str "({-"
+>		     . str "HappyReduction "
hunk ./src/ProduceCode.lhs 236
+>		     . str " =3D -}"
+>		     . happyReduction (brack monad_tycon)
+>		     . str ")"
}

Context:

[update following recent Cabal changes
Simon Marlow <simonmar at microsoft.com>**20071026150947] =

[TAG 1.17 RELEASE
Simon Marlow <simonmar at microsoft.com>**20071023145501] =

Patch bundle hash:
7b85a9d0b16a315f2996831afcf214299b4bd4cb

--=_--

.




More information about the Cvs-ghc mailing list