Frage

Ich schreibe einen Compiler für eine Klasse ich nehme. Die Klasse ist nicht speziell Haskell, aber ich bin mit Haskell zu meinem Compiler und Interpreter zu schreiben. Ich habe ein Kabale Paket Setup hoffentlich es leicht zu run / Kompilierung für meine prof machen. Ich habe glücklich und alex im Build-Tools Feld für beide ausführbaren Dateien aber Cabal ignoriert das und dann beschwert sich, dass es nicht die Module finden, dass glückliche und Alex Erzeugungs sein sollte. Wenn ich manuell ausführen:

alex LimpScanner.x
happy LimpParser.y

dann Kabale läuft perfekt.

Ich dachte, ich hätte Kabale sie automatisch früher ausgeführt wird, aber vielleicht erinnere ich mich unvollkommen.

limp.cabal:

-- limp.cabal auto-generated by cabal init. For additional options,
-- see
-- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.
-- The name of the package.
Name:                limp

-- The package version. See the Haskell package versioning policy
-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
-- standards guiding when and how versions should be incremented.
Version:             0.1

-- A short (one-line) description of the package.
Synopsis:            LIMP Compiler (Compiler Construction course project)

-- A longer description of the package.
-- Description:         

-- URL for the project homepage or repository.
Homepage:            http://www.cs.rit.edu/~eca7215/limp/

-- The license under which the package is released.
License:             AllRightsReserved

-- The file containing the license text.
License-file:        LICENSE

-- The package author(s).
Author:              Edward Amsden

-- An email address to which users can send suggestions, bug reports,
-- and patches.
Maintainer:          eca7215@cs.rit.edu

-- A copyright notice.
-- Copyright:           

Category:            Language

Build-type:          Simple

-- Extra files to be distributed with the package, such as examples or
-- a README.
-- Extra-source-files:  

-- Constraint on the version of Cabal needed to build this package.
Cabal-version:       >=1.2


Executable limp
  -- .hs or .lhs file containing the Main module.
  Main-is: Limp.hs

  hs-source-dirs: src     

  -- Packages needed in order to build this package.
  Build-depends: base, array, haskell98     

  -- Modules not exported by this package.
  -- Other-modules:       

  -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.
  Build-tools:         alex, happy
Executable limpi
  Main-is: LimpInterpreter.hs
  hs-source-dirs: src
  Build-depends: base, array, haskell98
  Build-tools: alex, happy

Verzeichnis Layout:

limp/
├── Setup.hs
├── limp.cabal
└── src/
    ├── Limp.hs
    ├── LimpInterpreter.hs
    ├── LimpParser.ly
    ├── LimpScanner.x
    └── LimpToken.hs
War es hilfreich?

Lösung 2

Offenbar, was ich fehlte, war eigentlich die Other-Module: Feld. Sobald dieser hinzugefügt wurde, Cabal glücklich (pardon das Wortspiel) gebaut meinen Dolmetscher.

Andere Tipps

Für Warren Harris und andere wie er (und ich), die später kommen, können andere-Module Anforderungen an eine Liste von Modulnamen festgelegt werden, dass (ich glaube?) Erwartet von den Werkzeugen in Build aufgeführt gebaut werden -werkzeuge.

Also, in meinem Fall, die entsprechenden Abschnitte meiner .cabal Datei beendet aussehen wie folgt aus:

build-tools:         alex, happy
other-modules:       Language.Heidi.Parser,
                     Language.Heidi.Lexer
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top