diff --git a/src-2.9/FILES b/src-2.9/FILES new file mode 100644 index 000000000..1311108b6 --- /dev/null +++ b/src-2.9/FILES @@ -0,0 +1,260 @@ + +Code map for GF source files. + +$Author: peb $ +$Date: 2005/02/07 10:58:08 $ + +Directories: + +[top level] GF main function and runtime-related modules +api high-level access to GF functionalities +canonical GFC (= GF Canonical) basic functionalities +cf context-free skeleton used in parsing +cfgm multilingual context-free skeleton exported to Java +compile compilation phases from GF to GFC +conversions [OBSOLETE] formats used in parser generation +for-ghc GHC-specific files (Glasgow Haskell Compiler) +for-hugs Hugs-specific files (a Haskell interpreter) +for-windows Windows-specific files (an operating system from Microsoft) +grammar basic functionalities of GF grammars used in compilation +infra GF-independent infrastructure and auxiliaries +newparsing parsing with GF grammars: current version (cf. parsing) +notrace debugging utilities for parser development (cf. trace) +parsers parsers of GF and GFC files +parsing [OBSOLETE] parsing with GF grammars: old version (cf. newparsing) +shell interaction shells +source utilities for reading in GF source files +speech generation of speech recognition grammars +trace debugging utilities for parser development (cf. notrace) +useGrammar grammar functionalities for applications +util utilities for using GF + + +Individual files: + +GF.hs the Main module +GFModes.hs +HelpFile.hs [AUTO] help file generated by util/MkHelpFile +Today.hs [AUTO] file generated by "make today" + +api/API.hs high-level access to GF functionalities +api/BatchTranslate.hs +api/GetMyTree.hs +api/GrammarToHaskell.hs +api/IOGrammar.hs +api/MyParser.hs slot for defining your own parser + +canonical/AbsGFC.hs [AUTO] abstract syntax of GFC +canonical/CanonToGrammar.hs +canonical/CMacros.hs +canonical/ErrM.hs +canonical/GetGFC.hs +canonical/GFC.cf [LBNF] source of GFC parser +canonical/GFC.hs +canonical/LexGFC.hs +canonical/Look.hs +canonical/MkGFC.hs +canonical/PrExp.hs +canonical/PrintGFC.hs pretty-printer of GFC +canonical/Share.hs +canonical/SkelGFC.hs [AUTO] +canonical/TestGFC.hs [AUTO] +canonical/Unlex.hs + +cf/CanonToCF.hs +cf/CF.hs abstract syntax of context-free grammars +cf/CFIdent.hs +cf/CFtoGrammar.hs +cf/CFtoSRG.hs +cf/ChartParser.hs the current default parsing method +cf/EBNF.hs +cf/PPrCF.hs +cf/PrLBNF.hs +cf/Profile.hs + +cfgm/CFG.cf [LBNF] source +cfgm/AbsCFG.hs [AUTO] +cfgm/LexCFG.hs [AUTO] +cfgm/ParCFG.hs [AUTO] +cfgm/PrintCFG.hs [AUTO] +cfgm/PrintCFGrammar.hs + +compile/CheckGrammar.hs +compile/Compile.hs the complete compiler pipeline +compile/Extend.hs +compile/GetGrammar.hs +compile/GrammarToCanon.hs +compile/MkResource.hs +compile/MkUnion.hs +compile/ModDeps.hs +compile/Optimize.hs +compile/PGrammar.hs +compile/PrOld.hs +compile/Rebuild.hs +compile/RemoveLiT.hs +compile/Rename.hs +compile/ShellState.hs the run-time multilingual grammar datastructure +compile/Update.hs + +for-ghc/ArchEdit.hs +for-ghc/Arch.hs + +for-ghc-nofud/ArchEdit.hs@ +for-ghc-nofud/Arch.hs@ + +for-hugs/ArchEdit.hs +for-hugs/Arch.hs +for-hugs/JGF.hs +for-hugs/MoreCustom.hs +for-hugs/Unicode.hs + +for-hugs/Arch.hs +for-hugs/ArchEdit.hs +for-hugs/JGF.hs +for-hugs/LexCFG.hs dummy CFG lexer +for-hugs/LexGF.hs dummy GF lexer +for-hugs/LexGFC.hs dummy GFC lexer +for-hugs/MoreCustom.hs +for-hugs/ParCFG.hs dummy CFG parser +for-hugs/ParGFC.hs dummy GFC parser +for-hugs/ParGF.hs dummy GF parser +for-hugs/Tracing.hs +for-hugs/Unicode.hs + +for-windows/ArchEdit.hs +for-windows/Arch.hs + +grammar/AbsCompute.hs +grammar/Abstract.hs GF and GFC abstract syntax datatypes +grammar/AppPredefined.hs +grammar/Compute.hs +grammar/Grammar.hs GF source grammar datatypes +grammar/LookAbs.hs +grammar/Lookup.hs +grammar/Macros.hs macros for creating GF terms and types +grammar/MMacros.hs more macros, mainly for abstract syntax +grammar/PatternMatch.hs +grammar/PrGrammar.hs the top-level grammar printer +grammar/Refresh.hs +grammar/ReservedWords.hs +grammar/TC.hs Coquand's type checking engine +grammar/TypeCheck.hs +grammar/Unify.hs +grammar/Values.hs + +infra/Arabic.hs ASCII coding of Arabic Unicode +infra/Assoc.hs finite maps/association lists as binary search trees +infra/CheckM.hs +infra/Comments.hs +infra/Devanagari.hs ASCII coding of Devanagari Unicode +infra/ErrM.hs +infra/Ethiopic.hs +infra/EventF.hs +infra/ExtendedArabic.hs +infra/ExtraDiacritics.hs +infra/FudgetOps.hs +infra/Glue.hs +infra/Greek.hs +infra/Hebrew.hs +infra/Hiragana.hs +infra/Ident.hs +infra/LatinASupplement.hs +infra/Map.hs finite maps as red black trees +infra/Modules.hs +infra/OCSCyrillic.hs +infra/Operations.hs library of strings, search trees, error monads +infra/Option.hs +infra/OrdMap2.hs abstract class of finite maps + implementation as association lists +infra/OrdSet.hs abstract class of sets + implementation as sorted lists +infra/Parsers.hs +infra/ReadFiles.hs +infra/RedBlack.hs red black trees +infra/RedBlackSet.hs sets and maps as red black trees +infra/Russian.hs +infra/SortedList.hs sets as sorted lists +infra/Str.hs +infra/Tamil.hs +infra/Text.hs +infra/Trie2.hs +infra/Trie.hs +infra/UnicodeF.hs +infra/Unicode.hs +infra/UseIO.hs +infra/UTF8.hs UTF3 en/decoding +infra/Zipper.hs + +newparsing/CFGrammar.hs type definitions for context-free grammars +newparsing/CFParserGeneral.hs several variants of general CFG chart parsing +newparsing/CFParserIncremental.hs several variants of incremental (Earley-style) CFG chart parsing +newparsing/ConvertGFCtoMCFG.hs converting GFC to MCFG +newparsing/ConvertGrammar.hs conversions between different grammar formats +newparsing/ConvertMCFGtoCFG.hs converting MCFG to CFG +newparsing/GeneralChart.hs Haskell framework for "parsing as deduction" +newparsing/GrammarTypes.hs instantiations of grammar types +newparsing/IncrementalChart.hs Haskell framework for incremental chart parsing +newparsing/MCFGrammar.hs type definitions for multiple CFG +newparsing/MCFParserBasic.hs MCFG chart parser +newparsing/MCFRange.hs ranges for MCFG parsing +newparsing/ParseCFG.hs parsing of CFG +newparsing/ParseCF.hs parsing of the CF format +newparsing/ParseGFC.hs parsing of GFC +newparsing/ParseMCFG.hs parsing of MCFG +newparsing/Parser.hs general definitions for parsers +newparsing/PrintParser.hs pretty-printing class for parsers +newparsing/PrintSimplifiedTerm.hs simplified pretty-printing for GFC terms + +notrace/Tracing.hs tracing predicates when we DON'T want tracing capabilities (normal case) + +parsers/ParGFC.hs [AUTO] +parsers/ParGF.hs [AUTO] + +shell/CommandF.hs +shell/CommandL.hs line-based syntax of editor commands +shell/Commands.hs commands of GF editor shell +shell/IDE.hs +shell/JGF.hs +shell/PShell.hs +shell/ShellCommands.hs commands of GF main shell +shell/Shell.hs +shell/SubShell.hs +shell/TeachYourself.hs + +source/AbsGF.hs [AUTO] +source/ErrM.hs +source/GF.cf [LBNF] source of GF parser +source/GrammarToSource.hs +source/LexGF.hs [AUTO] +source/PrintGF.hs [AUTO] +source/SourceToGrammar.hs + +speech/PrGSL.hs +speech/PrJSGF.hs +speech/SRG.hs +speech/TransformCFG.hs + +trace/Tracing.hs tracing predicates when we want tracing capabilities + +translate/GFT.hs Main module of html-producing batch translator + +useGrammar/Custom.hs database for customizable commands +useGrammar/Editing.hs +useGrammar/Generate.hs +useGrammar/GetTree.hs +useGrammar/Information.hs +useGrammar/Linear.hs the linearization algorithm +useGrammar/MoreCustom.hs +useGrammar/Morphology.hs +useGrammar/Paraphrases.hs +useGrammar/Parsing.hs the top-level parsing algorithm +useGrammar/Randomized.hs +useGrammar/RealMoreCustom.hs +useGrammar/Session.hs +useGrammar/TeachYourself.hs +useGrammar/Tokenize.hs lexer definitions (listed in Custom) +useGrammar/Transfer.hs + +util/GFDoc.hs utility for producing LaTeX and HTML from GF +util/HelpFile source of ../HelpFile.hs +util/Htmls.hs utility for chopping a HTML document to slides +util/MkHelpFile.hs +util/WriteF.hs diff --git a/src-2.9/GF-embed.cabal b/src-2.9/GF-embed.cabal new file mode 100644 index 000000000..54dce00b6 --- /dev/null +++ b/src-2.9/GF-embed.cabal @@ -0,0 +1,52 @@ +Name: gf-embed +Version: 2.8 +Cabal-version: >= 1.2 +Build-type: Simple +License: GPL +License-file: ../LICENSE +Synopsis: Grammatical Framework embedded API. + +Flag split-base + +Library + Build-depends: mtl, haskell98 + if flag(split-base) + Build-depends: base >= 3.0, array, containers, directory, random + else + Build-depends: base < 3.0 + Ghc-options: -O2 + Extensions: + Exposed-Modules: + GF.GFCC.API + -- needed by code generated by -haskell + GF.GFCC.DataGFCC + GF.GFCC.CId + Other-modules: + GF.Conversion.SimpleToFCFG + GF.Data.Assoc + GF.Data.Utilities + GF.Data.SortedList + GF.Data.BacktrackM + GF.Data.ErrM + GF.Data.GeneralDeduction + GF.Data.RedBlackSet + GF.Text.UTF8 + GF.Infra.CompactPrint + GF.Infra.PrintClass + GF.Formalism.FCFG + GF.Formalism.Utilities + GF.Parsing.FCFG + GF.Parsing.FCFG.PInfo + GF.Parsing.FCFG.Range + GF.Parsing.FCFG.Active + GF.Command.PPrTree + GF.Command.AbsGFShell + GF.Command.PrintGFShell + GF.Command.ParGFShell + GF.Command.LexGFShell + GF.GFCC.Macros + GF.GFCC.Generate + GF.GFCC.Linearize + GF.GFCC.Raw.AbsGFCCRaw + GF.GFCC.Raw.ParGFCCRaw + GF.GFCC.Raw.ConvertGFCC diff --git a/src-2.9/GF.hs b/src-2.9/GF.hs new file mode 100644 index 000000000..50afeb8e9 --- /dev/null +++ b/src-2.9/GF.hs @@ -0,0 +1,153 @@ +{-# OPTIONS -cpp #-} +---------------------------------------------------------------------- +-- | +-- Module : Main +-- Maintainer : Aarne Ranta +-- Stability : (stability) +-- Portability : (portability) +-- +-- > CVS $Date: 2005/06/30 11:36:49 $ +-- > CVS $Author: aarne $ +-- > CVS $Revision: 1.29 $ +-- +-- The Main module of GF program. +----------------------------------------------------------------------------- + +module Main (main) where + +import GF.GFModes (gfInteract, gfBatch, batchCompile) +import GF.Data.Operations +import GF.Infra.UseIO +import GF.Infra.Option +import GF.API.IOGrammar +import GF.Compile.ShellState +import GF.Compile.Compile +import GF.Compile.MkConcrete +import GF.Compile.Wordlist +import GF.Shell +import GF.Shell.SubShell +import GF.Shell.ShellCommands +import GF.Shell.PShell +import GF.Shell.JGF +import GF.System.Signal +import GF.Text.UTF8 + +import GF.Today (today,version,libdir) +import GF.System.Arch +import System (getArgs,system,getEnv) +import System.FilePath +import Control.Monad (foldM,liftM) +import Data.List (nub) + +#ifdef mingw32_HOST_OS +import System.Win32.Console +import System.Win32.NLS +#endif + +-- AR 19/4/2000 -- 21/3/2006 + +main :: IO () +main = do +#ifdef mingw32_HOST_OS + codepage <- getACP + setConsoleCP codepage + setConsoleOutputCP codepage +#endif + + xs <- getArgs + let + (os,fs) = getOptions "-" xs + opt j = oElem j os + st0 = optInitShellState os + ifNotSil c = if oElem beSilent os then return () else c + + doGF os fs = case 0 of + + _ | opt getHelp || any opt (map iOpt ["h", "-help", "-h"])-> do + putStrLnFlush $ encodeUTF8 helpMsg + + _ | opt forJava -> do + welcome <- welcomeMsgLib + putStrLnFlush $ encodeUTF8 welcome + st <- useIOE st0 $ + foldM (shellStateFromFiles os) st0 fs + sessionLineJ True st + return () + + _ | opt doMake -> do + mapM_ (batchCompile os) fs + return () + + _ | opt makeConcrete -> do + mkConcretes os fs + + _ | opt openEditor -> do + system $ "jgf" +++ unwords xs + return () + + _ | opt doBatch -> do + if opt beSilent then return () else putStrLnFlush "" + st <- useIOE st0 $ + foldM (shellStateFromFiles os) st0 fs + gfBatch (initHState st) + if opt beSilent then return () else putStrLnFlush "" + return () + _ -> do + welcome <- welcomeMsgLib + ifNotSil $ putStrLnFlush $ welcome + st <- useIOE st0 $ + foldM (shellStateFromFiles os) st0 fs + if null fs then return () else (ifNotSil putCPU) + blockInterrupt (gfInteract (initHState st)) + return () + -- preprocessing gfe + if opt fromExamples + then do + es <- liftM (nub . concat) $ mapM (getGFEFiles os) fs + mkConcretes os es + doGF (removeOption fromExamples os) fs + -- preprocessing gfwl + else if (length fs == 1 && takeExtensions (head fs) == ".gfwl") + then do + fs' <- mkWordlist (head fs) + doGF os fs' + else doGF os fs + +helpMsg = unlines [ + "Usage: gf