2010-12-16 10 views
12

私は服用しているクラス用のコンパイラを作成しています。クラスは特にハスケルではありませんが、私はコンパイラーとインタプリタを書くのに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 
+0

限り、あなたは状態として使用すると、モジュール 'LimpParser'と' LimpScanner'を使用すること、という名前のファイルを持っています'LimpParser.x'と' LimpScanner.ly'をインストールし、AlexとHappyをインストールした場合、去年からのCabalバージョンは自動的に 'alex'と' happy'を実行するはずです。うーん。 – ephemient

+0

詳細が必要です。あなたのディレクトリレイアウトは何ですか?キャバルファイルは何ですか? –

+0

これは逆のことではないでしょうか? LimpParser.lyとLimpScanner.x? – Edward

答えて

10

は、どうやら私が欠けていたものを、実際に他の-モジュールでした。これが追加されたら、私の通訳を喜んで(馬鹿を赦して)キャバルが建てました。

+1

これはあなた自身の答えです。 –

+6

この例を完成して、他のモジュールをどのように設定するべきかを示してください。ありがとう、 –

14

ウォーレンハリスと他の人が彼(そして私)のように後で来るかもしれないと、他のモジュールは、(おそらく?)にリストされているツールによって構築されると予想されるモジュール名のリストに設定する必要がありますビルドツール。だから、

、私の場合、私の.cabalファイルの関連セクションはこのように見てしまった:

build-tools:   alex, happy 
other-modules:  Language.Heidi.Parser, 
        Language.Heidi.Lexer 
関連する問題