Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/ckit/src/ast/parse-to-ast.sml
ViewVC logotype

View of /sml/trunk/ckit/src/ast/parse-to-ast.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 597 - (download) (annotate)
Wed Apr 5 18:34:51 2000 UTC (22 years, 5 months ago) by dbm
File size: 1436 byte(s)
Initial revision
(* parse-to-ast.sml *)

structure ParseToAst : PARSE_TO_AST =

  type astBundle =
    {ast: Ast.ast,
     tidtab: Bindings.tidBinding Tidtab.uidtab,
     errorCount: int,
     warningCount: int,
     auxiliaryInfo: {aidtab: Tables.aidtab,
	             implicits: Tables.aidtab,
                     env: State.symtab}}

  fun progToState ({tidtab, auxiliaryInfo={aidtab, implicits, env}, ...} : astBundle) =

  fun fileToAst' errStrm (sizes: Sizes.sizes, stateInfo: State.stateInfo) inFile
         : astBundle = 
	(* suppress underscores to make error message more readable *)
	val suppressPidUnderscores = !PPLib.suppressPidUnderscores
	val suppressTidUnderscores = !PPLib.suppressTidUnderscores
	val _ = (PPLib.suppressPidUnderscores := true;
		 PPLib.suppressTidUnderscores := true)
	val errState = Error.mkErrState errStrm
	val p = Parser.parseFile errState inFile
	val result = BuildAst.makeAst (sizes,stateInfo,errState) p
	PPLib.suppressPidUnderscores := suppressPidUnderscores;
	PPLib.suppressTidUnderscores := suppressTidUnderscores;
  fun fileToAst inFile =
    fileToAst' TextIO.stdErr (Sizes.defaultSizes, State.INITIAL) inFile

  fun fileToC x = 
      let val {ast, tidtab, ...} = fileToAst x
       in PPLib.ppToStrm (PPAst.ppAst () tidtab) TextIO.stdOut ast

end (* structure ParseToAst *)

ViewVC Help
Powered by ViewVC 1.0.0