質問

私は撮影しているクラスのコンパイラを書いています。クラスは具体的にはHaskellではありませんが、Haskellを使用してコンパイラとインタープリターを作成しています。私は、教授が実行/コンパイルを簡単にすることを願っています。私は両方の実行可能ファイルのビルドツールフィールドにHappyとAlexがいますが、Cabalはそれを無視し、HappyとAlexが生成すべきモジュールを見つけることができないと不満を述べています。手動で実行した場合:

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:          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

ディレクトリレイアウト:

limp/
├── Setup.hs
├── limp.cabal
└── src/
    ├── Limp.hs
    ├── LimpInterpreter.hs
    ├── LimpParser.ly
    ├── LimpScanner.x
    └── LimpToken.hs
役に立ちましたか?

解決 2

どうやら私が欠けていたのは、実際には他のモジュール:フィールドでした。これが追加されると、カバルは喜んで(しゃれを許して)私の通訳を建てました。

他のヒント

ウォーレン・ハリスや彼(私自身)のような他の人にとっては、他のモジュールは、ビルドツールにリストされているツールによって構築されると予想されるモジュール名のリストに設定する必要があります。

したがって、私の場合、.cabalファイルの関連セクションは次のようになりました。

build-tools:         alex, happy
other-modules:       Language.Heidi.Parser,
                     Language.Heidi.Lexer
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top