<commit_before>%
% (c) The GRASP/AQUA Project, Glasgow University, 1993-1996
%
\section[GHC_Main]{Main driver for Glasgow Haskell compiler}

\begin{code}
#include "HsVersions.h"

module Main ( main ) where

IMP_Ubiq(){-uitous-}
IMPORT_1_3(IO(hGetContents,stdin,stderr,hPutStr,hClose,openFile,IOMode(..)))

import HsSyn
import RdrHsSyn		( RdrName )
import BasicTypes	( NewOrData(..) )

import ReadPrefix	( rdModule )
import Rename		( renameModule )
import RnMonad		( ExportEnv )

import MkIface		-- several functions
import TcModule		( typecheckModule )
import Desugar		( deSugar, pprDsWarnings
#if __GLASGOW_HASKELL__ <= 200
		          , DsMatchContext, DsWarnFlavour 
#endif
			)
import SimplCore	( core2core )
import CoreToStg	( topCoreBindsToStg )
import StgSyn		( collectFinalStgBinders )
import SimplStg		( stg2stg )
import CodeGen		( codeGen )
#if ! OMIT_NATIVE_CODEGEN
import AsmCodeGen	( dumpRealAsm, writeRealAsm )
#endif

import AbsCSyn		( absCNop, AbstractC )
import AbsCUtils	( flattenAbsC )
import CoreUnfold	( Unfolding )
import Bag		( emptyBag, isEmptyBag )
import CmdLineOpts
import ErrUtils		( pprBagOfErrors, ghcExit )
import Maybes		( maybeToBool, MaybeErr(..) )
import Specialise	( SpecialiseData(..) )
import StgSyn		( pprPlainStgBinding, GenStgBinding )
import TcInstUtil	( InstInfo )
import TyCon		( isDataTyCon )
import UniqSupply	( mkSplitUniqSupply )

import PprAbsC		( dumpRealC, writeRealC )
import PprCore		( pprCoreBinding )
import Outputable	( PprStyle(..), Outputable(..) )
import Pretty

import Id		( GenId )		-- instances
import Name		( Name )		-- instances
import PprType		( GenType, GenTyVar )	-- instances
import TyVar		( GenTyVar )		-- instances
import Unique		( Unique )		-- instances
\end{code}

\begin{code}
main =
 _scc_ "main" 
 hGetContents stdin	>>= \ input_pgm ->
 let
    cmd_line_info = classifyOpts
 in
 doIt cmd_line_info input_pgm
\end{code}

\begin{code}
doIt :: ([CoreToDo], [StgToDo]) -> String -> IO ()

doIt (core_cmds, stg_cmds) input_pgm
  = doDump opt_Verbose ("Glasgow Haskell Compiler, version " ++ show PROJECTVERSION ++ ", for Haskell 1.4" "") >>
    -- ******* READER
    show_pass "Reader"	>>
    _scc_     "Reader"
    rdModule		>>= \ (mod_name, rdr_module) ->

    doDump opt_D_dump_rdr "Reader:"
	(pp_show (ppr pprStyle rdr_module))	>>

    doDump opt_D_source_stats "\nSource Statistics:"
	(pp_show (ppSourceStats rdr_module)) 	>>

    -- UniqueSupplies for later use (these are the only lower case uniques)
--    _scc_     "spl-rn"
    mkSplitUniqSupply 'r'	>>= \ rn_uniqs 	-> -- renamer
--    _scc_     "spl-tc"
    mkSplitUniqSupply 'a'	>>= \ tc_uniqs 	-> -- typechecker
--    _scc_     "spl-ds"
    mkSplitUniqSupply 'd'	>>= \ ds_uniqs 	-> -- desugarer
--    _scc_     "spl-sm"
    mkSplitUniqSupply 's'	>>= \ sm_uniqs 	-> -- core-to-core simplifier
--    _scc_     "spl-c2s"
    mkSplitUniqSupply 'c'	>>= \ c2s_uniqs -> -- core-to-stg
--    _scc_     "spl-st"<commit_msg>[project @ 1997-07-27 01:27:06 by sof]<commit_after>%
% (c) The GRASP/AQUA Project, Glasgow University, 1993-1996
%
\section[GHC_Main]{Main driver for Glasgow Haskell compiler}

\begin{code}
#include "HsVersions.h"

module Main ( main ) where

IMP_Ubiq(){-uitous-}
IMPORT_1_3(IO(hGetContents,stdin,stderr,hPutStr,hClose,openFile,IOMode(..)))

import HsSyn
import RdrHsSyn		( RdrName )
import BasicTypes	( NewOrData(..) )

import ReadPrefix	( rdModule )
import Rename		( renameModule )
import RnMonad		( ExportEnv )

import MkIface		-- several functions
import TcModule		( typecheckModule )
import Desugar		( deSugar, pprDsWarnings
#if __GLASGOW_HASKELL__ <= 200
		          , DsMatchContext, DsWarnFlavour 
#endif
			)
import SimplCore	( core2core )
import CoreToStg	( topCoreBindsToStg )
import StgSyn		( collectFinalStgBinders )
import SimplStg		( stg2stg )
import CodeGen		( codeGen )
#if ! OMIT_NATIVE_CODEGEN
import AsmCodeGen	( dumpRealAsm, writeRealAsm )
#endif

import AbsCSyn		( absCNop, AbstractC )
import AbsCUtils	( flattenAbsC )
import CoreUnfold	( Unfolding )
import Bag		( emptyBag, isEmptyBag )
import CmdLineOpts
import ErrUtils		( pprBagOfErrors, ghcExit )
import Maybes		( maybeToBool, MaybeErr(..) )
import Specialise	( SpecialiseData(..) )
import StgSyn		( pprPlainStgBinding, GenStgBinding )
import TcInstUtil	( InstInfo )
import TyCon		( isDataTyCon )
import UniqSupply	( mkSplitUniqSupply )

import PprAbsC		( dumpRealC, writeRealC )
import PprCore		( pprCoreBinding )
import Outputable	( PprStyle(..), Outputable(..) )
import Pretty

import Id		( GenId )		-- instances
import Name		( Name )		-- instances
import PprType		( GenType, GenTyVar )	-- instances
import TyVar		( GenTyVar )		-- instances
import Unique		( Unique )		-- instances
\end{code}

\begin{code}
main =
 _scc_ "main" 
 hGetContents stdin	>>= \ input_pgm ->
 let
    cmd_line_info = classifyOpts
 in
 doIt cmd_line_info input_pgm
\end{code}

\begin{code}
doIt :: ([CoreToDo], [StgToDo]) -> String -> IO ()

doIt (core_cmds, stg_cmds) input_pgm
  = doDump opt_Verbose ("Glasgow Haskell Compiler, version " ++ show PROJECTVERSION ++ ", for Haskell 1.4") "" >>
    -- ******* READER
    show_pass "Reader"	>>
    _scc_     "Reader"
    rdModule		>>= \ (mod_name, rdr_module) ->

    doDump opt_D_dump_rdr "Reader:"
	(pp_show (ppr pprStyle rdr_module))	>>

    doDump opt_D_source_stats "\nSource Statistics:"
	(pp_show (ppSourceStats rdr_module)) 	>>

    -- UniqueSupplies for later use (these are the only lower case uniques)
--    _scc_     "spl-rn"
    mkSplitUniqSupply 'r'	>>= \ rn_uniqs 	-> -- renamer
--    _scc_     "spl-tc"
    mkSplitUniqSupply 'a'	>>= \ tc_uniqs 	-> -- typechecker
--    _scc_     "spl-ds"
    mkSplitUniqSupply 'd'	>>= \ ds_uniqs 	-> -- desugarer
--    _scc_     "spl-sm"
    mkSplitUniqSupply 's'	>>= \ sm_uniqs 	-> -- core-to-core simplifier
--    _scc_     "spl-c2s"
    mkSplitUniqSupply 'c'	>>= \ c2s_uniqs -> -- core-to-stg
--    _scc_     "spl-st"
{'fraction_non_alphanumeric': 0.11948622612810546, 'fraction_numerical': 0.008788237282406625, 'mean_word_length': 3.573415765069552, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6856534', 'n_tokens_mistral': 2416, 'n_tokens_neox': 2326, 'n_words': 515}