2010-12-16 13 views
12

के साथ एलेक्स/खुश का उपयोग करके मैं एक कक्षा के लिए एक कंपाइलर लिख रहा हूं। कक्षा विशेष रूप से हास्केल नहीं है लेकिन मैं अपने कंपाइलर और दुभाषिया लिखने के लिए हास्केल का उपयोग कर रहा हूं। मेरे पास एक कैबल पैकेज सेटअप है जो आशा करता है कि मेरे प्रोफेसर को चलाने/संकलित करने में आसानी हो। मेरे पास दोनों एक्जिक्यूटिव के लिए बिल्ड-टूल्स फ़ील्ड में खुश और एलेक्स है लेकिन कैबल उस पर ध्यान नहीं देता है और फिर शिकायत करता है कि यह उन मॉड्यूल को नहीं ढूंढ सकता है जो हैप्पी और एलेक्स उत्पन्न होनी चाहिए। अगर मैं मैन्युअल रूप से चलाएँ:कैबल

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' का उपयोग करें, नामित फ़ाइलें:

तो, मेरे मामले में, मेरे .cabal फ़ाइल के प्रासंगिक अनुभाग ऊपर इस तरह देख समाप्त हो गया 'LimpParser.x' और' LimpScanner.ly', और एलेक्स और हैप्पी स्थापित है, तो पिछले वर्ष से किसी भी कैबल संस्करण को स्वचालित रूप से 'एलेक्स' और 'खुश' चलाया जाना चाहिए था। हम्म। – ephemient

+0

हमें और जानकारी चाहिए। आपकी निर्देशिका लेआउट क्या है? आपकी कैबल फाइल क्या है? –

+0

क्या यह दूसरी तरफ नहीं होना चाहिए? LimpParser.ly और LimpScanner.x? – Edward

उत्तर

10

वास्तव में था अन्य-मॉड्यूल मैं जाहिरा तौर पर क्या याद आ रही थी: क्षेत्र। एक बार यह जोड़ा गया, खुशी से कैबल (पन क्षमा करें) मेरे दुभाषिया बनाया।

+1

अपने आप को जवाब देने के लिए आप पर अच्छा लगा। –

+6

क्या आप उदाहरण पूरा कर सकते हैं और दिखा सकते हैं कि अन्य मॉड्यूल को किस पर सेट किया जाना चाहिए? धन्यवाद, –

14

वॉरेन हैरिस और उनके जैसे अन्य (और खुद) जो बाद में आ सकते हैं, अन्य मॉड्यूल को मॉड्यूल नामों की एक सूची में सेट करने की आवश्यकता है (मुझे लगता है?) में सूचीबद्ध उपकरणों द्वारा निर्मित होने की उम्मीद है निर्माण उपकरण। जब तक

build-tools:   alex, happy 
other-modules:  Language.Heidi.Parser, 
        Language.Heidi.Lexer 
संबंधित मुद्दे