나는 수업을 듣기 위해 컴파일러를 작성하고 있습니다. 클래스는 하스켈이 아니지만 하스켈을 사용하여 컴파일러와 인터프리터를 작성합니다. 나는 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
을 언제 까지나 :
는그래서, 내 경우에는, 내 .cabal 파일의 관련 부분은 다음과 같이보고 결국 'LimpParser.x'와'LimpScanner.ly' 파일에 Alex와 Happy가 설치되어 있다면 지난 해의 Cabal 버전은 자동으로'alex'와'happy'를 실행해야합니다. 흠. – ephemient
자세한 내용이 필요합니다. 귀하의 디렉토리 레이아웃은 무엇입니까? Cabal 파일은 무엇입니까? –
다른 길은 아닌가요? LimpParser.ly 및 LimpScanner.x? – Edward