私は服用しているクラス用のコンパイラを作成しています。クラスは特にハスケルではありませんが、私はコンパイラーとインタプリタを書くのにHaskellを使っています。うまくいけば、私のprofが簡単に実行/コンパイルできるようにcabalパッケージの設定があります。私は両方の実行可能ファイルのbuild-toolsフィールドに幸せとアレックスを持っていますが、Cabalはそれを無視して、HappyとAlexが生成するモジュールを見つけることができないと不平を言う。私が手動で実行した場合:alex/happy with Cabalを使用しています
alex LimpScanner.x
happy LimpParser.y
キャバルが完全に実行されます。
私はカバールを自動的に以前に実行していると思っていましたが、おそらく私は不完全に覚えています。
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: [email protected]
-- 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
ディレクトリレイアウト:フィールド:
limp/
├── Setup.hs
├── limp.cabal
└── src/
├── Limp.hs
├── LimpInterpreter.hs
├── LimpParser.ly
├── LimpScanner.x
└── LimpToken.hs
限り、あなたは状態として使用すると、モジュール 'LimpParser'と' LimpScanner'を使用すること、という名前のファイルを持っています'LimpParser.x'と' LimpScanner.ly'をインストールし、AlexとHappyをインストールした場合、去年からのCabalバージョンは自動的に 'alex'と' happy'を実行するはずです。うーん。 – ephemient
詳細が必要です。あなたのディレクトリレイアウトは何ですか?キャバルファイルは何ですか? –
これは逆のことではないでしょうか? LimpParser.lyとLimpScanner.x? – Edward