Changeset 7843
- Timestamp:
- 11/05/05 11:41:57 (3 years ago)
- Files:
-
- 5 added
- 1 removed
- 9 modified
-
Pugs.cabal.in (modified) (1 diff)
-
docs/AES/S22draft.pod (modified) (5 diffs)
-
script/pugscc (modified) (1 diff)
-
src/Pugs/CodeGen.hs (modified) (4 diffs)
-
src/Pugs/CodeGen/PIL.hs (deleted)
-
src/Pugs/CodeGen/PIL1.hs (added)
-
src/Pugs/CodeGen/PIL2.hs (added)
-
src/Pugs/Compile/Pugs.hs (modified) (7 diffs)
-
src/Pugs/Embed.hs (modified) (3 diffs)
-
src/Pugs/Embed/Pugs.hs (added)
-
src/Pugs/PIL2.hs (added)
-
src/Pugs/PIL2.hs-drift (added)
-
src/Pugs/Parser.hs (modified) (2 diffs)
-
src/Pugs/PreludePC.hs-null (modified) (1 diff)
-
src/Pugs/Run.hs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Pugs.cabal.in
r7579 r7843 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.PIL 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.Eval Pugs.Eval.Var Pugs.External Pugs.External.Haskell Pugs.Help Pugs.Internals Pugs.Junc Pugs.Lexer Pugs.Monads Pugs.PIL1Pugs.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.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__ -
docs/AES/S22draft.pod
r7842 r7843 9 9 Jos Boumans <kane@cpan.org> 10 10 Autrijus Tang <autrijus@autrijus.org> 11 Florian Ragwitz <rafl@debian.org>12 11 13 12 =head1 VERSION … … 24 23 25 24 'package management means several things': 26 - metadata collection (1) perl6-thingy or maybe debtags?25 - metadata collection (1) perl6-thingy 27 26 - package building (2) make dist 28 27 - intermediate format for transport … … 30 29 - decomposed to hooks and probes 31 30 - uploading package to central area (3) CPAN 32 - indexing (4) apt-ftparchive 33 - I don't think apt-ftparchive is enough here. I think we'll need to set up 34 or even wright something like dak, the Debian archive maintaince scripts 35 packages.debian.org/dak 36 - understanding/querying index (5) apt-cache, debtags 31 - indexing (4) aptftp-archive 32 - understanding/querying index (5) apt-cache 37 33 - fetching package 38 34 - building final package (6) dpkg-deb … … 116 112 117 113 =head3 Repositories 118 119 My ideas for the repository layout look like this. It's modeled after the120 Debian archive structure.121 122 /123 |- dists/ This directory only contains so called Packages files.124 | | They know some meta-information about the packages (description, ...)125 | | and a path to the real package inside pool/. Using this Packages126 | | files modules can be categorized very well. There are more then the127 | | showed categories possible, of course. It's only an example.128 | |129 | |- authors/ The whole archive sorted by authors130 | | |- stevan.gz Stevan's modules131 | | |- autrijus.gz All of autrijus modules132 | | |- autrijus/133 | | | |- Perl6-Pugs.gz Individual modules134 | | | `- Acme-Hello.gz135 | | `- rafl.gz rafl's modules.136 | |137 | |- languages/ The archive sorted by language138 | | |- perl.gz All available perl modules139 | | |- perl/140 | | | |- kane.gz kane's modules141 | | | `- gbarr.gz gbarr's modules142 | | |- js.gz All js modules143 | | |- js/144 | | |- ruby.gz145 | | `- ruby/ Ruby stuff146 | |147 | `- modules/ Categorized by modules148 | |- DBI/149 | | |- timb.gz Tim's DBI150 | | `- rafl.gz My DBI151 | |- Net-SMTP/152 | `- Net-IMCP/153 |154 `- pool/ The real modules are stored here. The Packages files point here.155 |- a/ Modules startihg with 'a'156 | |- Acme-Foo/ All Acme-Foo versions157 | | |- Acme-Foo-0.1.deb Packages for specific Acme-Foo versions158 | | `- Acme-Foo-0.2.deb159 | |- Acme-Bar/160 | `- Acme-Hello/161 |- b/162 |- c/163 |- ./164 |- ./165 |- ./166 |- y/167 `- z/168 114 169 115 =head3 Probing … … 261 207 - without which we can't possibly roll this out 262 208 263 rafl thinks:264 - dpkg seems to be not the optimal choice265 - maybe only adopt the package and metadata format from the .deb format version 2266 and write the tools to manipulate and install it ourself. Preferably in Perl 6.267 - I fear that tools like dpkg/apt/.. aren't portable as we need it because they268 were mainly written for use with a single Linux distribution.269 - The Debian tools can be useful as a provisional solutions until we wrote270 something own or as a reference implementation.271 272 209 =head2 Policy File 273 210 -
script/pugscc
r7830 r7843 91 91 my $rv = system( 92 92 $ghc_exe, 93 "-v0", "-o", $out, "--make", "-main-is", "MainCC.mainCC", 94 "$base/MainCC.hs" 93 "-v0", "-O", "-o", $out, "--make", "$base/MainCC.hs" 95 94 ); 96 95 -
src/Pugs/CodeGen.hs
r7127 r7843 13 13 import Pugs.AST 14 14 import Pugs.Internals 15 import Pugs.CodeGen.PIL (genPIL) 15 import Pugs.CodeGen.PIL1 (genPIL1) 16 import Pugs.CodeGen.PIL2 (genPIL2) 16 17 import Pugs.CodeGen.PIR (genPIR) 17 18 import Pugs.CodeGen.Perl5 (genPerl5) … … 20 21 import Pugs.Compile.Pugs (genPugs) 21 22 import Pugs.Compile.Haskell (genGHC) 22 -- import Pugs.CodeGen.PIL2 (genPIL2)23 23 -- import Pugs.CodeGen.XML (genXML) 24 24 import qualified Data.Map as Map … … 31 31 , ("Parrot", genPIR) 32 32 , ("PIR", genPIR) 33 , ("PIL ", genPIL)34 --, ("PIL2", genPIL2)33 , ("PIL1", genPIL1) 34 , ("PIL2", genPIL2) 35 35 , ("Perl5", genPerl5) 36 36 , ("Pugs", genPugs) … … 49 49 norm' "parrot" = "Parrot" 50 50 norm' "pir" = "PIR" 51 norm' "pil" = "PIL" 52 -- norm' "pil2" = "PIL2" 51 norm' "pil" = "PIL1" -- XXX - this will change 52 norm' "pil1" = "PIL1" 53 norm' "pil2" = "PIL2" 53 54 norm' "perl5" = "Perl5" 54 55 norm' "pugs" = "Pugs" -
src/Pugs/Compile/Pugs.hs
r5360 r7843 1 {-# OPTIONS_GHC -cpp -fglasgow-exts -fth#-}1 {-# OPTIONS_GHC -cpp -fglasgow-exts #-} 2 2 3 3 #include "../pugs_config.h" … … 8 8 import Pugs.Internals 9 9 import Text.PrettyPrint 10 import qualified Data.Map as Map 10 11 11 12 class (Show x) => Compile x where … … 25 26 26 27 prettyDo :: [Doc] -> Doc 27 prettyDo docs = parens $ sep (text "do":punctuate semi docs)28 prettyDo docs = parens $ text "do" <+> braces (sep $ punctuate semi docs) 28 29 29 30 prettyRecord :: String -> [(String, Doc)] -> Doc … … 32 33 33 34 prettyBind :: String -> Doc -> Doc 34 prettyBind var doc = text var `sep1` nest 1 (text "<-" <+> doc) 35 35 prettyBind var doc = text var <+> text "<-" <+> doc 36 36 37 37 instance Compile (Maybe Exp) where … … 127 127 ] 128 128 129 instance Compile (TVar Bool) where 130 compile fresh = do 131 bool <- liftSTM $ readTVar fresh 132 return $ text "liftSTM" <+> parens (text "newTVar" <+> text (show bool)) 133 134 instance Compile (TVar VRef) where 129 instance Compile Bool where 130 compile bool = return $ text "return" <+> parens (text $ show bool) 131 132 instance Compile a => Compile (Map VStr a) where 133 compile map | Map.null map = return (text "return Map.empty") 134 compile map = error (show map) 135 136 instance Compile (IVar VScalar) where 137 compile iv = do 138 val <- readIVar iv 139 valC <- compile val 140 return $ prettyDo 141 [ prettyBind "val" valC 142 , text "newScalar val" 143 ] 144 145 instance (Typeable a, Compile a) => Compile (TVar a) where 135 146 compile fresh = do 136 147 vref <- liftSTM $ readTVar fresh … … 169 180 , text "return $ VCode code" 170 181 ] 182 compile (VObject obj) = do 183 objC <- compile obj 184 return $ prettyDo 185 [ prettyBind "obj" objC 186 , text "return $ VObject obj" 187 ] 171 188 compile x = return $ text "return" $+$ parens (text $ show x) 172 189 173 -- We need a compile VObject! 190 instance Compile VObject where 191 compile (MkObject typ attrs Nothing _) = do 192 attrsC <- compile attrs 193 let vobj = prettyRecord "MkObject" $ 194 [ ("objType", text (show typ)) 195 , ("objAttrs", text "attrs") 196 , ("objOpaque", text "Nothing") 197 , ("objId", text "id") 198 ] 199 return $ prettyDo 200 [ prettyBind "attrs" attrsC 201 , prettyBind "id" (text "liftIO newUnique") 202 , text "return" <+> parens vobj 203 ] 204 compile obj = fail $ "Cannot compile Object of Dynamic type: " ++ show obj 174 205 175 206 -- Haddock can't cope with Template Haskell … … 207 238 expC <- compile exp 208 239 return . VStr . unlines $ 209 [ "{-# OPTIONS_GHC -fglasgow-exts -fno-warn-unused-imports -fno-warn-unused-binds -O#-}"210 , "module Main CCwhere"240 [ "{-# OPTIONS_GHC -fglasgow-exts -fno-warn-unused-imports -fno-warn-unused-binds #-}" 241 , "module Main where" 211 242 , "import Pugs.Run" 212 243 , "import Pugs.AST" 213 244 , "import Pugs.Types" 214 245 , "import Pugs.Internals" 215 , "" 216 , "mainCC = do" 246 , "import qualified Data.Map as Map" 247 , "" 248 , "main = do" 217 249 , " glob <- globC" 218 250 , " exp <- expC" -
src/Pugs/Embed.hs
r4655 r7843 14 14 module Pugs.Embed.Haskell, 15 15 module Pugs.Embed.Parrot, 16 module Pugs.Embed.Pugs, 16 17 evalEmbedded 17 18 -- module Pugs.Embed.Ponie, … … 20 21 import Pugs.Embed.Haskell 21 22 import Pugs.Embed.Parrot 22 -- import Pugs.Embed.Ponie 23 import Pugs.Embed.Pugs 23 24 24 25 evalEmbedded :: String -> String -> IO () … … 26 27 evalEmbedded "PIR" = evalParrot 27 28 evalEmbedded "Parrot" = evalParrot 29 evalEmbedded "Pugs" = evalPugs 28 30 {- evalEmbedded "Haskell" code = do 29 31 evalHaskell code -
src/Pugs/Parser.hs
r7815 r7843 984 984 -- state $?FIRST_RESULT; 985 985 -- state $?FIRST_RUN; 986 -- $?FIRST_RUN || { $?FIRST_RUN++; $?FIRST_RESULT = { 42 }() }; 987 -- $?FIRST_RESULT; 986 -- $?FIRST_RUN++ ?? $?FIRST_RESULT !! $?FIRST_RESULT = { 42 }(); 988 987 -- } 989 988 -- These are the two state variables we need. … … 994 993 return $ Syn "block" -- The outer block 995 994 [ Pad SState lexDiff $ -- state ($?FIRST_RESULT, $?FIRST_RUN); 996 Stmts (App (Var "&infix:||") -- $?FIRST_RUN || 997 Nothing 998 [ Var "$?FIRST_RUN" 999 , Stmts (App (Var "&postfix:++") Nothing [Var "$?FIRST_RUN"]) 1000 (Syn "=" [Var "$?FIRST_RESULT", App (Val code) Nothing []]) 1001 ]) -- { $?FIRST_RUN++; $?FIRST_RESULT = { 42 }() }; 1002 (Var "$?FIRST_RESULT") -- $?FIRST_RESULT; 995 Syn "if" 996 [ App (Var "&postfix:++") Nothing [Var "$?FIRST_RUN"] 997 , Var "$?FIRST_RESULT" 998 , Syn "=" [Var "$?FIRST_RESULT", App (Val code) Nothing []] 999 ] -- { $?FIRST_RUN++; $?FIRST_RESULT = { 42 }() }; 1003 1000 ] 1004 1001 -
src/Pugs/PreludePC.hs-null
r7838 r7843 1 1 {-# OPTIONS_GHC -fglasgow-exts -fno-full-laziness -fno-cse #-} 2 3 import Pugs.Prim.Eval 2 4 3 5 {- -
src/Pugs/Run.hs
r7838 r7843 26 26 import Pugs.Eval 27 27 import Pugs.Prim 28 import Pugs.Prim.Eval29 28 import Pugs.Embed 30 29 import Data.IORef
