diff --git a/packages/backend-lalr/data/HappyTemplate.hs b/packages/backend-lalr/data/HappyTemplate.hs index e9125ea6..ba5de31c 100644 --- a/packages/backend-lalr/data/HappyTemplate.hs +++ b/packages/backend-lalr/data/HappyTemplate.hs @@ -38,25 +38,13 @@ data Happy_IntList = HappyCons FAST_INT Happy_IntList -#if defined(HAPPY_ARRAY) -# define CONS(h,t) (HappyCons (h) (t)) -#else -# define CONS(h,t) ((h):(t)) -#endif +#define CONS(h,t) (HappyCons (h) (t)) -#if defined(HAPPY_ARRAY) -# define ERROR_TOK ILIT(0) -# define DO_ACTION(state,i,tk,sts,stk) happyDoAction i tk state sts (stk) -# define HAPPYSTATE(i) (i) -# define GOTO(action) happyGoto -# define IF_ARRAYS(x) (x) -#else -# define ERROR_TOK ILIT(1) -# define DO_ACTION(state,i,tk,sts,stk) state i i tk HAPPYSTATE(state) sts (stk) -# define HAPPYSTATE(i) (HappyState (i)) -# define GOTO(action) action -# define IF_ARRAYS(x) -#endif +#define ERROR_TOK ILIT(0) +#define DO_ACTION(state,i,tk,sts,stk) happyDoAction i tk state sts (stk) +#define HAPPYSTATE(i) (i) +#define GOTO(action) happyGoto +#define IF_ARRAYS(x) (x) #if defined(HAPPY_COERCE) # if !defined(HAPPY_GHC) @@ -102,8 +90,6 @@ happyAccept j tk st sts (HappyStk ans _) = ----------------------------------------------------------------------------- -- Arrays only: do the next action -#if defined(HAPPY_ARRAY) - happyDoAction i tk st = DEBUG_TRACE("state: " ++ show IBOX(st) ++ ",\ttoken: " ++ show IBOX(i) ++ @@ -131,8 +117,6 @@ happyDoAction i tk st | check = indexShortOffAddr happyTable off_i | Prelude.otherwise = indexShortOffAddr happyDefActions st -#endif /* HAPPY_ARRAY */ - #ifdef HAPPY_GHC indexShortOffAddr (HappyA# arr) off = Happy_GHC_Exts.narrow16Int# i @@ -161,21 +145,6 @@ readArrayBit arr bit = data HappyAddr = HappyA# Happy_GHC_Exts.Addr# #endif ------------------------------------------------------------------------------ --- HappyState data type (not arrays) - -#if !defined(HAPPY_ARRAY) - -newtype HappyState b c = HappyState - (FAST_INT -> -- token number - FAST_INT -> -- token number (yes, again) - b -> -- token semantic value - HappyState b c -> -- current state - [HappyState b c] -> -- state stack - c) - -#endif - ----------------------------------------------------------------------------- -- Shifting a token @@ -234,14 +203,9 @@ happyMonad2Reduce k nt fn j tk st sts stk = case happyDrop k CONS(st,sts) of sts1@(CONS(st1@HAPPYSTATE(action),_)) -> let drop_stk = happyDropStk k stk -#if defined(HAPPY_ARRAY) off = happyAdjustOffset (indexShortOffAddr happyGotoOffsets st1) off_i = PLUS(off, nt) new_state = indexShortOffAddr happyTable off_i -#else - _ = nt :: FAST_INT - new_state = action -#endif in happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk)) @@ -254,16 +218,12 @@ happyDropStk n (x `HappyStk` xs) = happyDropStk MINUS(n,(ILIT(1)::FAST_INT)) xs ----------------------------------------------------------------------------- -- Moving to a new state after a reduction -#if defined(HAPPY_ARRAY) happyGoto nt j tk st = DEBUG_TRACE(", goto state " ++ show IBOX(new_state) ++ "\n") happyDoAction j tk new_state where off = happyAdjustOffset (indexShortOffAddr happyGotoOffsets st) off_i = PLUS(off, nt) new_state = indexShortOffAddr happyTable off_i -#else -happyGoto action j tk st = action j j tk (HappyState action) -#endif ----------------------------------------------------------------------------- -- Error recovery (ERROR_TOK is the error token) @@ -320,14 +280,13 @@ happyDontSeq a b = b -- of deciding to inline happyGoto everywhere, which increases the size of -- the generated parser quite a bit. -#if defined(HAPPY_ARRAY) {-# NOINLINE happyDoAction #-} {-# NOINLINE happyTable #-} {-# NOINLINE happyCheck #-} {-# NOINLINE happyActOffsets #-} {-# NOINLINE happyGotoOffsets #-} {-# NOINLINE happyDefActions #-} -#endif + {-# NOINLINE happyShift #-} {-# NOINLINE happySpecReduce_0 #-} {-# NOINLINE happySpecReduce_1 #-} diff --git a/packages/backend-lalr/happy-backend-lalr.cabal b/packages/backend-lalr/happy-backend-lalr.cabal index 30729fd8..f81541a9 100644 --- a/packages/backend-lalr/happy-backend-lalr.cabal +++ b/packages/backend-lalr/happy-backend-lalr.cabal @@ -46,7 +46,6 @@ library hs-source-dirs: src exposed-modules: Happy.Backend.LALR, - Happy.Backend.LALR.Target, Happy.Backend.LALR.ProduceCode build-depends: base < 5, array, diff --git a/packages/backend-lalr/src/Happy/Backend/LALR.hs b/packages/backend-lalr/src/Happy/Backend/LALR.hs index 61e82768..54651041 100644 --- a/packages/backend-lalr/src/Happy/Backend/LALR.hs +++ b/packages/backend-lalr/src/Happy/Backend/LALR.hs @@ -41,12 +41,11 @@ langExtsToInject ghc | ghc = ["MagicHash", "BangPatterns", "TypeSynonymInstances", "FlexibleInstances"] | otherwise = [] -defines :: Bool -> Bool -> Bool -> Bool -> String -defines debug array ghc coerce = unlines [ "#define " ++ d ++ " 1" | d <- vars_to_define ] +defines :: Bool -> Bool -> Bool -> String +defines debug ghc coerce = unlines [ "#define " ++ d ++ " 1" | d <- vars_to_define ] where vars_to_define = concat [ [ "HAPPY_DEBUG" | debug ] - , [ "HAPPY_ARRAY" | array ] , [ "HAPPY_GHC" | ghc ] , [ "HAPPY_COERCE" | coerce ] - ] \ No newline at end of file + ] diff --git a/packages/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs b/packages/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs index 68fb5288..b134699b 100644 --- a/packages/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs +++ b/packages/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs @@ -10,10 +10,9 @@ The code generator. > import Data.Version ( showVersion ) > import Happy.CodeGen.Common.Options > import Happy.Grammar -> import Happy.Backend.LALR.Target ( Target(..) ) > import Happy.Tabular.LALR -> import Data.Maybe ( isJust, isNothing, fromMaybe ) +> import Data.Maybe ( isNothing, fromMaybe ) > import Data.Char ( ord, chr ) > import Data.List ( sortBy ) @@ -35,7 +34,6 @@ Produce the complete output file. > -> [String] -- language extensions > -> Maybe String -- module header > -> Maybe String -- module trailer -> -> Target -- type of code required > -> Bool -- use coercions > -> Bool -- use ghc extensions > -> Bool -- strict parser @@ -64,16 +62,15 @@ Produce the complete output file. > , error_sig = error_sig' > }) > action goto lang_exts module_header module_trailer -> target coerce ghc strict +> coerce ghc strict > = ( top_opts > . maybestr module_header . nl > . str comment > -- comment goes *after* the module header, so that we > -- don't screw up any OPTIONS pragmas in the header. > . produceAbsSynDecl . nl -> . produceTypes > . produceExpListPerState -> . produceActionTable target +> . produceActionTable > . produceReductions > . produceTokenConverter . nl > . produceIdentityStuff @@ -223,72 +220,6 @@ example where this matters. > where all_tyvars = [ 't':show n | (n, Nothing) <- assocs nt_types ] > str_tyvars = str (unwords all_tyvars) -%----------------------------------------------------------------------------- -Type declarations of the form: - -type HappyReduction a b = .... -action_0, action_1 :: Int -> HappyReduction a b -reduction_1, ... :: HappyReduction a b - -These are only generated if types for *all* rules are given (and not for array -based parsers -- types aren't as important there). - -> produceTypes -> | target == TargetArrayBased = id - -> | all isJust (elems nt_types) = -> happyReductionDefinition . str "\n\n" -> . interleave' ",\n " -> [ mkActionName i | (i,_action') <- zip [ 0 :: Int .. ] -> (assocs action) ] -> . str " :: " . str monad_context . str " => " -> . intMaybeHash . str " -> " . happyReductionValue . str "\n\n" -> . interleave' ",\n " -> [ mkReduceFun i | -> (i,_action) <- zip [ n_starts :: Int .. ] -> (drop n_starts prods) ] -> . str " :: " . str monad_context . str " => " -> . happyReductionValue . str "\n\n" - -> | otherwise = id - -> where tokens = -> case lexer' of -> Nothing -> char '[' . token . str "] -> " -> Just _ -> id -> happyReductionDefinition = -> str "{- to allow type-synonyms as our monads (likely\n" -> . str " - with explicitly-specified bind and return)\n" -> . str " - in Haskell98, it seems that with\n" -> . str " - /type M a = .../, then /(HappyReduction M)/\n" -> . str " - is not allowed. But Happy is a\n" -> . str " - code-generator that can just substitute it.\n" -> . str "type HappyReduction m = " -> . happyReduction (str "m") -> . str "\n-}" -> happyReductionValue = -> str "({-" -> . str "HappyReduction " -> . brack monad_tycon -> . str " = -}" -> . happyReduction (brack monad_tycon) -> . str ")" -> happyReduction m = -> str "\n\t " -> . intMaybeHash -> . str " \n\t-> " . token -> . str "\n\t-> HappyState " -> . token -> . str " (HappyStk HappyAbsSyn -> " . tokens . result -> . str ")\n\t" -> . str "-> [HappyState " -> . token -> . str " (HappyStk HappyAbsSyn -> " . tokens . result -> . str ")] \n\t-> HappyStk HappyAbsSyn \n\t-> " -> . tokens -> . result -> where result = m . str " HappyAbsSyn" - %----------------------------------------------------------------------------- Next, the reduction functions. Each one has the following form: @@ -367,22 +298,19 @@ happyMonadReduce to get polymorphic recursion. Sigh. > -- adjust the nonterminal number for the array-based parser > -- so that nonterminals start at zero. -> adjusted_nt | target == TargetArrayBased = nt - first_nonterm' -> | otherwise = nt -> +> adjusted_nt = nt - first_nonterm' + > mkReductionHdr lt' s = > let tysig = case lexer' of > Nothing -> id -> _ | target == TargetArrayBased -> -> mkReduceFun i . str " :: " . pcont -> . str " => " . intMaybeHash -> . str " -> " . str token_type' -> . str " -> " . intMaybeHash -> . str " -> Happy_IntList -> HappyStk " -> . happyAbsSyn . str " -> " -> . pty . str " " . happyAbsSyn . str "\n" -> | otherwise -> id in -> filterTypeSig tysig . mkReduceFun i . str " = " +> _ -> mkReduceFun i . str " :: " . pcont +> . str " => " . intMaybeHash +> . str " -> " . str token_type' +> . str " -> " . intMaybeHash +> . str " -> Happy_IntList -> HappyStk " +> . happyAbsSyn . str " -> " +> . pty . str " " . happyAbsSyn . str "\n" +> in filterTypeSig tysig . mkReduceFun i . str " = " > . str s . strspace . lt' . strspace . showInt adjusted_nt > . strspace . reductionFun . nl > . reductionFun . strspace @@ -448,24 +376,7 @@ The token conversion function. > -- so we must not pass it to happyError' > Just (lexer'',eof') -> -> case (target, ghc) of -> (TargetHaskell, True) -> -> str "happyNewToken :: " . pcont . str " => " -> . str "(Happy_GHC_Exts.Int#\n" -> . str " -> Happy_GHC_Exts.Int#\n" -> . str " -> " . token . str "\n" -> . str " -> HappyState " . token . str " (t -> " -> . pty . str " a)\n" -> . str " -> [HappyState " . token . str " (t -> " -> . pty . str " a)]\n" -> . str " -> t\n" -> . str " -> " . pty . str " a)\n" -> . str " -> [HappyState " . token . str " (t -> " -> . pty . str " a)]\n" -> . str " -> t\n" -> . str " -> " . pty . str " a\n" -> _ -> id -> . str "happyNewToken action sts stk\n\t= " +> str "happyNewToken action sts stk\n\t= " > . str lexer'' > . str "(\\tk -> " > . str "\n\tlet cont i = " @@ -485,19 +396,13 @@ The token conversion function. > where -> eofAction tk = -> (case target of -> TargetArrayBased -> -> str "happyDoAction " . eofTok . strspace . str tk . str " action" -> _ -> str "action " . eofTok . strspace . eofTok -> . strspace . str tk . str " (HappyState action)") -> . str " sts stk" +> eofAction tk = str "happyDoAction " +> . eofTok . strspace . str tk +> . str " action" . str " sts stk" > eofTok = showInt (tokIndex eof) -> -> doAction = case target of -> TargetArrayBased -> str "happyDoAction i tk action" -> _ -> str "action i i tk (HappyState action)" -> + +> doAction = str "happyDoAction i tk action" + > doToken (i,tok) > = str (removeDollarDollar tok) > . str " -> cont " @@ -521,10 +426,7 @@ the left hand side of '@'. > Just str' -> mapDollarDollar str' > pat = mkHappyVar i -> tokIndex -> = case target of -> TargetHaskell -> id -> TargetArrayBased -> \i -> i - n_nonterminals - n_starts - 2 +> tokIndex i = i - n_nonterminals - n_starts - 2 > -- tokens adjusted to start at zero, see ARRAY_NOTES %----------------------------------------------------------------------------- @@ -575,15 +477,12 @@ straight back to a state where the error token can be shifted, or if none exists, we'll get a parse error. In theory, we won't need the machinery to discard states in the parser... -> produceActionTable TargetHaskell -> = foldr (.) id (map (produceStateFunction goto) (assocs action)) -> -> produceActionTable TargetArrayBased +> produceActionTable > = produceActionArray > . produceReduceArray > . str "happy_n_terms = " . shows n_terminals . str " :: Prelude.Int\n" > . str "happy_n_nonterms = " . shows n_nonterminals . str " :: Prelude.Int\n\n" -> + > produceExpListPerState > = produceExpListArray > . str "{-# NOINLINE happyExpListPerState #-}\n" @@ -602,55 +501,6 @@ machinery to discard states in the parser... > . str "\n" > where (first_token, last_token) = bounds token_names' > nr_tokens = last_token - first_token + 1 -> -> produceStateFunction goto' (state, acts) -> = foldr (.) id (map produceActions assocs_acts) -> . foldr (.) id (map produceGotos (assocs gotos)) -> . mkActionName state -> . (if ghc -> then str " x = happyTcHack x " -> else str " _ = ") -> . mkAction default_act -> . (case default_act of -> LR'Fail -> callHappyExpListPerState -> LR'MustFail -> callHappyExpListPerState -> _ -> str "") -> . str "\n\n" -> -> where gotos = goto' ! state -> -> callHappyExpListPerState = str " (happyExpListPerState " -> . str (show state) . str ")" -> -> produceActions (_, LR'Fail{-'-}) = id -> produceActions (t, action'@(LR'Reduce{-'-} _ _)) -> | action' == default_act = id -> | otherwise = producePossiblyFailingAction t action' -> produceActions (t, action') -> = producePossiblyFailingAction t action' -> -> producePossiblyFailingAction t action' -> = actionFunction t -> . mkAction action' -> . (case action' of -> LR'Fail -> str " []" -> LR'MustFail -> str " []" -> _ -> str "") -> . str "\n" -> -> produceGotos (t, Goto i) -> = actionFunction t -> . str "happyGoto " . mkActionName i . str "\n" -> produceGotos (_, NoGoto) = id -> -> actionFunction t -> = mkActionName state . strspace -> . ('(' :) . showInt t -> . str ") = " -> -> default_act = getDefault assocs_acts -> -> assocs_acts = assocs acts action array indexed by (terminal * last_state) + state @@ -861,37 +711,29 @@ MonadStuff: > . errorHandler . str "\n" > _ -> > let -> happyParseSig -> | target == TargetArrayBased = -> str "happyParse :: " . pcont . str " => " . intMaybeHash +> happyParseSig = +> str "happyParse :: " . pcont . str " => " . intMaybeHash > . str " -> " . pty . str " " . happyAbsSyn . str "\n" > . str "\n" -> | otherwise = id -> newTokenSig -> | target == TargetArrayBased = -> str "happyNewToken :: " . pcont . str " => " . intMaybeHash +> newTokenSig = +> str "happyNewToken :: " . pcont . str " => " . intMaybeHash > . str " -> Happy_IntList -> HappyStk " . happyAbsSyn > . str " -> " . pty . str " " . happyAbsSyn . str"\n" > . str "\n" -> | otherwise = id -> doActionSig -> | target == TargetArrayBased = -> str "happyDoAction :: " . pcont . str " => " . intMaybeHash +> doActionSig = +> str "happyDoAction :: " . pcont . str " => " . intMaybeHash > . str " -> " . str token_type' . str " -> " . intMaybeHash > . str " -> Happy_IntList -> HappyStk " . happyAbsSyn > . str " -> " . pty . str " " . happyAbsSyn . str "\n" > . str "\n" -> | otherwise = id -> reduceArrSig -> | target == TargetArrayBased = -> str "happyReduceArr :: " . pcont +> reduceArrSig = +> str "happyReduceArr :: " . pcont > . str " => Happy_Data_Array.Array Prelude.Int (" . intMaybeHash > . str " -> " . str token_type' . str " -> " . intMaybeHash > . str " -> Happy_IntList -> HappyStk " . happyAbsSyn > . str " -> " . pty . str " " . happyAbsSyn . str ")\n" > . str "\n" -> | otherwise = id in -> filterTypeSig (happyParseSig . newTokenSig . doActionSig . reduceArrSig) +> in filterTypeSig (happyParseSig . newTokenSig . doActionSig . reduceArrSig) > . str "happyThen1 :: " . pcont . str " => " . pty > . str " a -> (a -> " . pty > . str " b) -> " . pty . str " b\n" @@ -939,11 +781,7 @@ directive determines the API of the provided function. > . str unmonad > . str "happySomeParser where\n" > . str " happySomeParser = happyThen (happyParse " -> . case target of -> TargetHaskell -> str "action_" . shows no -> TargetArrayBased -> | ghc -> shows no . str "#" -> | otherwise -> shows no +> . (if ghc then shows no . str "#" else shows no) > . maybe_tks > . str ") " > . brack' (if coerce @@ -1031,17 +869,6 @@ vars used in this piece of code. > actionVal LR'Fail = 0 > actionVal LR'MustFail = 0 -> mkAction :: LRAction -> String -> String -> mkAction (LR'Shift i _) = str "happyShift " . mkActionName i -> mkAction LR'Accept = str "happyAccept" -> mkAction LR'Fail = str "happyFail" -> mkAction LR'MustFail = str "happyFail" -> mkAction (LR'Reduce i _) = str "happyReduce_" . shows i -> mkAction (LR'Multiple _ a) = mkAction a - -> mkActionName :: Int -> String -> String -> mkActionName i = str "action_" . shows i - See notes under "Action Tables" above for some subtleties in this function. > getDefault :: [(Name, LRAction)] -> LRAction diff --git a/packages/backend-lalr/src/Happy/Backend/LALR/Target.lhs b/packages/backend-lalr/src/Happy/Backend/LALR/Target.lhs deleted file mode 100644 index 70f15216..00000000 --- a/packages/backend-lalr/src/Happy/Backend/LALR/Target.lhs +++ /dev/null @@ -1,13 +0,0 @@ ------------------------------------------------------------------------------ -The target data type. - -(c) 1993-2001 Andy Gill, Simon Marlow ------------------------------------------------------------------------------ - -> module Happy.Backend.LALR.Target (Target(..)) where - -> data Target -> = TargetHaskell -- functions and things -> | TargetArrayBased -- arrays - -> deriving Eq diff --git a/src/Main.lhs b/src/Main.lhs index 0ba95fc2..4279b2bb 100644 --- a/src/Main.lhs +++ b/src/Main.lhs @@ -18,7 +18,6 @@ Path settings auto-generated by Cabal: > import Happy.Frontend.Mangler > import Happy.Frontend.PrettyGrammar > import Happy.Backend.LALR -> import Happy.Backend.LALR.Target (Target(..)) > import Happy.Backend.LALR.ProduceCode (produceParser) > import Happy.Backend.GLR > import Happy.Backend.GLR.ProduceCode @@ -53,9 +52,6 @@ Read and parse the CLI arguments. > (cli,_,[]) | DumpHelp `elem` cli -> do > prog <- getProgramName > bye (usageInfo (usageHeader prog) argInfo) -> (cli,_,_) | OptDebugParser `elem` cli -> && OptArrayTarget `notElem` cli -> do -> die "Cannot use debugging without -a\n" > (cli,[fl_name],[]) -> > runParserGen cli fl_name > (_,_,errors) -> do @@ -174,11 +170,9 @@ Report any conflicts in the grammar. Now, let's get on with generating the parser. Firstly, find out what kind of code we should generate, and where it should go: -> target <- getTarget cli > outfilename <- getOutputFileName fl_name cli -> opt_coerce <- getCoerce target cli +> opt_coerce <- getCoerce cli > opt_strict <- getStrict cli -> opt_array <- getArray cli > opt_ghc <- getGhc cli > opt_debug <- getDebug cli @@ -268,12 +262,11 @@ CPP is needed in all cases with unified template > ("CPP" : langExtsToInject opt_ghc) > header > tl -> target > opt_coerce > opt_ghc > opt_strict -> defines' = defines opt_debug opt_array opt_ghc opt_coerce +> defines' = defines opt_debug opt_ghc opt_coerce > (if outfilename == "-" then putStr else writeFile outfilename) > (magicFilter magic_name (outfile ++ defines' ++ templ)) @@ -319,7 +312,7 @@ The command line arguments. > | OptPrettyFile (Maybe String) > | OptTemplate String > | OptMagicName String -> + > | OptGhcTarget > | OptArrayTarget > | OptUseCoercions @@ -383,15 +376,6 @@ Various debugging/dumping options... ------------------------------------------------------------------------------ Extract various command-line options. -> getTarget :: [CLIFlags] -> IO Target -> getTarget cli = case [ t | (Just t) <- map optToTarget cli ] of -> (t:ts) | all (==t) ts -> return t -> [] -> return TargetHaskell -> _ -> dieHappy "multiple target options\n" -> where -> optToTarget OptArrayTarget = Just TargetArrayBased -> optToTarget _ = Nothing - > getOutputFileName :: String -> [CLIFlags] -> IO String > getOutputFileName ip_file cli > = case [ s | (OptOutputFile s) <- cli ] of @@ -429,8 +413,8 @@ Extract various command-line options. > [] -> return Nothing > f:fs -> return (Just (map toLower (last (f:fs)))) -> getCoerce :: Target -> [CLIFlags] -> IO Bool -> getCoerce _target cli +> getCoerce :: [CLIFlags] -> IO Bool +> getCoerce cli > = if OptUseCoercions `elem` cli > then if OptGhcTarget `elem` cli > then return True @@ -438,9 +422,6 @@ Extract various command-line options. > "in conjunction with -g/--ghc\n") > else return False -> getArray :: [CLIFlags] -> IO Bool -> getArray cli = return (OptArrayTarget `elem` cli) - > getGhc :: [CLIFlags] -> IO Bool > getGhc cli = return (OptGhcTarget `elem` cli) diff --git a/tests/Makefile b/tests/Makefile index 84938bde..3e97c35a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -56,42 +56,24 @@ TEST_HAPPY_OPTS = --strict %.n.hs : %.ly $(HAPPY) $(TEST_HAPPY_OPTS) $< -o $@ -%.a.hs : %.ly - $(HAPPY) $(TEST_HAPPY_OPTS) -a $< -o $@ - %.g.hs : %.ly $(HAPPY) $(TEST_HAPPY_OPTS) -g $< -o $@ %.gc.hs : %.ly $(HAPPY) $(TEST_HAPPY_OPTS) -gc $< -o $@ -%.ag.hs : %.ly - $(HAPPY) $(TEST_HAPPY_OPTS) -ag $< -o $@ - -%.agc.hs : %.ly - $(HAPPY) $(TEST_HAPPY_OPTS) -agc $< -o $@ - %.n.hs : %.y $(HAPPY) $(TEST_HAPPY_OPTS) $< -o $@ -%.a.hs : %.y - $(HAPPY) $(TEST_HAPPY_OPTS) -a $< -o $@ - %.g.hs : %.y $(HAPPY) $(TEST_HAPPY_OPTS) -g $< -o $@ %.gc.hs : %.y $(HAPPY) $(TEST_HAPPY_OPTS) -gc $< -o $@ -%.ag.hs : %.y - $(HAPPY) $(TEST_HAPPY_OPTS) -ag $< -o $@ - -%.agc.hs : %.y - $(HAPPY) $(TEST_HAPPY_OPTS) -agc $< -o $@ - -CLEAN_FILES += *.n.hs *.a.hs *.g.hs *.gc.hs *.ag.hs *.agc.hs *.info *.hi *.bin *.exe *.o *.run.stdout *.run.stderr +CLEAN_FILES += *.n.hs *.g.hs *.gc.hs *.info *.hi *.bin *.exe *.o *.run.stdout *.run.stderr -ALL_TEST_HS = $(shell echo $(TESTS) | sed -e 's/\([^\. ]*\)\.\(l\)\{0,1\}y/\1.n.hs \1.a.hs \1.g.hs \1.gc.hs \1.ag.hs \1.agc.hs/g') +ALL_TEST_HS = $(shell echo $(TESTS) | sed -e 's/\([^\. ]*\)\.\(l\)\{0,1\}y/\1.n.hs \1.g.hs \1.gc.hs/g') ALL_TESTS = $(patsubst %.hs, %.run, $(ALL_TEST_HS)) @@ -118,15 +100,15 @@ check.%.y : %.y all :: $(CHECK_ERROR_TESTS) $(ALL_TESTS) check-todo:: - $(HAPPY) $(TEST_HAPPY_OPTS) -ad Test.ly + $(HAPPY) $(TEST_HAPPY_OPTS) -d Test.ly $(HC) Test.hs -o happy_test ./happy_test -rm -f ./happy_test - $(HAPPY) $(TEST_HAPPY_OPTS) -agd Test.ly + $(HAPPY) $(TEST_HAPPY_OPTS) -gd Test.ly $(HC) Test.hs -o happy_test ./happy_test -rm -f ./happy_test - $(HAPPY) $(TEST_HAPPY_OPTS) -agcd Test.ly + $(HAPPY) $(TEST_HAPPY_OPTS) -gcd Test.ly $(HC) Test.hs -o happy_test ./happy_test -rm -f ./happy_test