Changeset 7866
- Timestamp:
- 11/06/05 01:28:07 (3 years ago)
- Files:
-
- 4 modified
-
Pugs.cabal.in (modified) (1 diff)
-
src/Pugs/CodeGen.hs (modified) (4 diffs)
-
src/Pugs/CodeGen/PIL2.hs (modified) (2 diffs)
-
src/Pugs/Compile/PIL2.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Pugs.cabal.in
r7843 r7866 12 12 author: Autrijus Tang <autrijus@autrijus.org> 13 13 tested-with: GHC -any 14 exposed-modules: Pugs Pugs.AST Pugs.AST.Internals Pugs.AST.Pad Pugs.AST.Pos Pugs.AST.Prag Pugs.AST.SIO Pugs.AST.Scope Pugs.Bind Pugs.CodeGen Pugs.CodeGen.Binary Pugs.CodeGen.JSON Pugs.CodeGen.PIL1 Pugs.CodeGen.PIL2 Pugs.CodeGen.PIR Pugs.CodeGen.PIR.Prelude Pugs.CodeGen.Perl5 Pugs.Compat Pugs.Compile Pugs.Compile. Haskell Pugs.Compile.Pugs Pugs.Config Pugs.Cont Pugs.Embed Pugs.Embed.Haskell Pugs.Embed.Parrot Pugs.Embed.Perl5 Pugs.Embed.Pugs Pugs.Eval Pugs.Eval.Var Pugs.External Pugs.External.Haskell Pugs.Help Pugs.Internals Pugs.Junc Pugs.Lexer Pugs.Monads Pugs.PIL1 Pugs.PIL2 Pugs.Parser Pugs.Parser.Number Pugs.Parser.Program Pugs.Parser.Types Pugs.Parser.Unsafe Pugs.Pretty Pugs.Prim Pugs.Prim.Code Pugs.Prim.Eval Pugs.Prim.FileTest Pugs.Prim.Keyed Pugs.Prim.Lifts Pugs.Prim.List Pugs.Prim.Match Pugs.Prim.Numeric Pugs.Prim.Param Pugs.Prim.Yaml Pugs.Rule Pugs.Rule.Char Pugs.Rule.Combinator Pugs.Rule.Error Pugs.Rule.Expr Pugs.Rule.Language Pugs.Rule.Pos Pugs.Rule.Prim Pugs.Rule.Token Pugs.Run Pugs.Run.Args Pugs.Run.Perl5 Pugs.Shell Pugs.Types Pugs.Version Emit.Common Emit.PIR14 exposed-modules: Pugs Pugs.AST Pugs.AST.Internals Pugs.AST.Pad Pugs.AST.Pos Pugs.AST.Prag Pugs.AST.SIO Pugs.AST.Scope Pugs.Bind Pugs.CodeGen Pugs.CodeGen.Binary Pugs.CodeGen.JSON Pugs.CodeGen.PIL1 Pugs.CodeGen.PIL2 Pugs.CodeGen.PIR Pugs.CodeGen.PIR.Prelude Pugs.CodeGen.Perl5 Pugs.Compat Pugs.Compile Pugs.Compile.PIL2 Pugs.Compile.Haskell Pugs.Compile.Pugs Pugs.Config Pugs.Cont Pugs.Embed Pugs.Embed.Haskell Pugs.Embed.Parrot Pugs.Embed.Perl5 Pugs.Embed.Pugs Pugs.Eval Pugs.Eval.Var Pugs.External Pugs.External.Haskell Pugs.Help Pugs.Internals Pugs.Junc Pugs.Lexer Pugs.Monads Pugs.PIL1 Pugs.PIL2 Pugs.Parser Pugs.Parser.Number Pugs.Parser.Program Pugs.Parser.Types Pugs.Parser.Unsafe Pugs.Pretty Pugs.Prim Pugs.Prim.Code Pugs.Prim.Eval Pugs.Prim.FileTest Pugs.Prim.Keyed Pugs.Prim.Lifts Pugs.Prim.List Pugs.Prim.Match Pugs.Prim.Numeric Pugs.Prim.Param Pugs.Prim.Yaml Pugs.Rule Pugs.Rule.Char Pugs.Rule.Combinator Pugs.Rule.Error Pugs.Rule.Expr Pugs.Rule.Language Pugs.Rule.Pos Pugs.Rule.Prim Pugs.Rule.Token Pugs.Run Pugs.Run.Args Pugs.Run.Perl5 Pugs.Shell Pugs.Types Pugs.Version Emit.Common Emit.PIR 15 15 buildable: True 16 16 c-sources: src/cbits/fpstring.c src/pcre/pcre.c __UNICODE_C__ -
src/Pugs/CodeGen.hs
r7843 r7866 14 14 import Pugs.Internals 15 15 import Pugs.CodeGen.PIL1 (genPIL1) 16 import Pugs.CodeGen.PIL2 (genPIL2 )16 import Pugs.CodeGen.PIL2 (genPIL2, genPIL2Perl5, genPIL2Binary, genPIL2JSON) 17 17 import Pugs.CodeGen.PIR (genPIR) 18 18 import Pugs.CodeGen.Perl5 (genPerl5) … … 33 33 , ("PIL1", genPIL1) 34 34 , ("PIL2", genPIL2) 35 , ("PIL2-Perl5", genPIL2Perl5) 36 , ("PIL2-JSON", genPIL2JSON) 37 , ("PIL2-Binary", genPIL2Binary) 35 38 , ("Perl5", genPerl5) 36 39 , ("Pugs", genPugs) … … 44 47 45 48 norm :: String -> String 46 norm = norm' . map toLower 49 norm = norm' . map toLower . filter isAlphaNum 47 50 where 48 51 norm' "ghc" = "GHC" … … 53 56 norm' "pil2" = "PIL2" 54 57 norm' "perl5" = "Perl5" 58 norm' "pil2perl5" = "PIL2-Perl5" 59 norm' "pil2json" = "PIL2-JSON" 60 norm' "pil2binary" = "PIL2-Binary" 55 61 norm' "pugs" = "Pugs" 56 62 norm' "binary" = "Binary" -
src/Pugs/CodeGen/PIL2.hs
r7849 r7866 2 2 {-# OPTIONS_GHC -#include "../../UnicodeC.h" #-} 3 3 4 module Pugs.CodeGen.PIL2 (genPIL2) where 4 module Pugs.CodeGen.PIL2 ( 5 genPIL2, 6 genPIL2Perl5, genPIL2Binary, genPIL2JSON 7 ) where 5 8 import Pugs.Internals 6 9 import Pugs.AST 7 import Pugs.PIL1 8 import Pugs.Compile 10 import Pugs.PIL2 11 import Pugs.Compile.PIL2 12 import System.IO 13 import System.Directory 14 import DrIFT.Perl5 15 import DrIFT.Binary 16 import DrIFT.JSON 9 17 10 18 genPIL2 :: Eval Val … … 17 25 , " }" 18 26 ] 27 28 genPIL2Perl5 :: Eval Val 29 genPIL2Perl5 = do 30 penv <- compile () :: Eval PIL_Environment 31 return . VStr . unlines $ [showPerl5 penv] 32 33 genPIL2Binary :: Eval Val 34 genPIL2Binary = do 35 penv <- compile () :: Eval PIL_Environment 36 liftIO $ do 37 tmp <- getTemporaryDirectory 38 (file, fh) <- openBinaryTempFile tmp "pugs.bin" 39 bh <- openBinIO fh 40 put_ bh penv 41 hClose fh 42 return $ VStr (unlines [file]) 43 44 genPIL2JSON :: Eval Val 45 genPIL2JSON = do 46 penv <- compile () :: Eval PIL_Environment 47 return . VStr . unlines $ [showJSON penv] -
src/Pugs/Compile/PIL2.hs
r7865 r7866 1 1 {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances -fno-warn-orphans -funbox-strict-fields -cpp #-} 2 {-# OPTIONS_GHC -#include "../UnicodeC.h" #-} 3 4 {-| 5 Compiler interface. 6 7 > And words unheard were spoken then 8 > Of folk and Men and Elven-kin, 9 > Beyond the world were visions showed 10 > Forbid to those that dwell therein... 11 -} 12 13 module Pugs.Compile ( 2 {-# OPTIONS_GHC -#include "../../UnicodeC.h" #-} 3 4 module Pugs.Compile.PIL2 ( 14 5 PIL_Stmts(..), PIL_Stmt(..), PIL_Expr(..), PIL_Decl(..), PIL_Literal(..), PIL_LValue(..), 15 6 Compile(..), … … 26 17 import Pugs.Eval.Var 27 18 import Pugs.Monads 28 import Pugs.PIL 119 import Pugs.PIL2 29 20 import Emit.PIR 30 21 import Text.PrettyPrint
