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

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/README
ViewVC logotype

Diff of /sml/trunk/src/compiler/README

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 69, Fri Apr 3 00:06:55 1998 UTC revision 93, Tue May 12 21:56:22 1998 UTC
# Line 1  Line 1 
1  ============================================================================  ============================================================================
2  This README file describes the overall structure of the current version of  This README file describes the overall structure of the current version of
3  the SML/NJ (v110.4) & FLINT/ML (v1.4) compiler source tree. Please send  the SML/NJ (v110.4) & FLINT/ML (v1.4) compiler source tree. Please send
4  your questions, comments, and suggestions to flint@cs.yale.edu (or contact  your questions, comments, and suggestions to sml-nj@research.bell-labs.com.
 Zhong Shao at shao-zhong@cs.yale.edu).  
5  ============================================================================  ============================================================================
6    
7  NOTES  NOTES
# Line 18  Line 17 
17     only (i.e., CMB.make). The resulting binfiles from doing CMB.make     only (i.e., CMB.make). The resulting binfiles from doing CMB.make
18     are placed in a single bin directory, eg. bin.x86-unix or     are placed in a single bin directory, eg. bin.x86-unix or
19     bin.sparc-unix. Right now, the list in all-files.cm is just the     bin.sparc-unix. Right now, the list in all-files.cm is just the
20     list in sources.cm plus all the glue files in the 1-TopLevel/bootstrap     list in sources.cm plus all the glue files in the TopLevel/bootstrap
21     directory (which are used to bootstrap the interactive compiler).     directory (which are used to bootstrap the interactive compiler).
22    
 buildcm* compiler-name  
    A script for building the sml-cm version of the compiler. Suppose  
    you have build a SML heap image named sml.x86-unix, you type  
    "buildcm sml.x86-unix" to get the cm version of the compiler,  
    probably named "sml-cm.x86-unix".  
   
 buildcm2* compiler-name  
    Scripts for building a sml-cm compiler that knows where to  
    find the library and ml-lex and ml-yacc, etc. Need to adjust  
    the top-level directory name there.  
   
23  sources.cm  sources.cm
24     This file contains the usual makefile for CM.make. It is not     This file contains the usual makefile for CM.make. It is not
25     used to build up the interactive compiler. But it can be     used to build up the interactive compiler. But it can be
# Line 42  Line 30 
30     function to compile ML programs. Notice all the bootstrap glue     function to compile ML programs. Notice all the bootstrap glue
31     files are not in sources.cm.     files are not in sources.cm.
32    
33  xmakeml* [-full] [-elab]  makeml* [-full] [-elab]
34     A script for building the interactive compiler. The default path     A script for building the interactive compiler. The default path
35     of bin files is ./bin.$arch-$os. There are two command-line options:     of bin files is ./bin.$arch-$os. There are two command-line options:
36     if you add the "-full" option, it will build a compiler whose     if you add the "-full" option, it will build a compiler whose
# Line 52  Line 40 
40     your new compiler has changed the representations of the bindings     your new compiler has changed the representations of the bindings
41     in the static environments).     in the static environments).
42    
 xrun* compiler-name  
    A script for running the copmiler. Suppose you have a heap image  
    named "sml.x86-unix", you can type "xrun sml.x86-unix" to run the  
    compiler. Similarly, you can type "xrun sml-cm.x86-unix" to run  
    the CM version of the sml compiler. The xrun script uses the  
    runtime system in the ../../bin/.run directory.  
   
43  ============================================================================  ============================================================================
44  Tips:  Tips:
45     The current source code is organized as a two-level directory tree.     The current source code is organized as a two-level directory tree.
46     Apart from a few files which are placed immediately inside the 0-Boot     All source files can be grep-ed by typing "grep xxx */*/*.{sig,sml}",
47     directory (i.e., 0-Boot/*.{sig,sml}), all source files can be grep-ed     assuming you are looking for binding "xxx".
    by typing "grep xxx */*/*.{sig,sml}", assuming you are looking for  
    binding "xxx".  
48    
49     The following directories is organized based on the compilation phases.     The following directories is organized based on the compilation phases.
50     Within each phase, the "main" sub-directory always contains the top-level     Within each phase, the "main" sub-directory always contains the top-level
# Line 79  Line 58 
58       *.lex --- ML-Lex file       *.lex --- ML-Lex file
59       *.cm  --- the CM makefile       *.cm  --- the CM makefile
60    
61  0-Basis  PervEnv
62     The SML/NJ Initial Bootstrapping Library and the SML97 Basis Library.     The SML/NJ Initial Bootstrapping Library and the SML97 Basis Library.
63     When recompiling the compiler (i.e., via CMB.make), files in this     When recompiling the compiler (i.e., via CMB.make), files in this
64     directory are always compiled first. More specifically, their order     directory are always compiled first. More specifically, their order
65     of compilation is as follows:     of compilation is as follows:
66         (0)  build the initial primitive static environment         (0)  build the initial primitive static environment
67                (see 3-Semant/statenv/prim.sml)                (see Semant/statenv/prim.sml)
68         (1)  compile assembly.sig and dummy.sml, these two files         (1)  compile assembly.sig and dummy.sml, these two files
69              make up the static environment for the runtime structure              make up the static environment for the runtime structure
70              (coming from the ../runtime/kernel/globals.c file). The              (coming from the ../runtime/kernel/globals.c file). The
# Line 98  Line 77 
77         (4)  files in all-files.cm (must follow the exact order)         (4)  files in all-files.cm (must follow the exact order)
78         (5)  files in pervasive.cm (must follow the exact order)         (5)  files in pervasive.cm (must follow the exact order)
79    
80  1-TopLevel  TopLevel
81     This directory contains the top-level glue files for different versions     This directory contains the top-level glue files for different versions
82     of the batch and interactive compiler.  To understand, how the compiler     of the batch and interactive compiler.  To understand, how the compiler
83     is organized, you can read the main directory.     is organized, you can read the main directory.
84  1-TopLevel/batch/  TopLevel/batch/
85     Utility files for the Compilation Manager CM and CMB;     Utility files for the Compilation Manager CM and CMB;
86  1-TopLevel/bootstrap/  TopLevel/bootstrap/
87     How to bootstrap an interactive compiler. Details are in boot.sml and     How to bootstrap an interactive compiler. Details are in boot.sml and
88     shareglue.sml. Before building an interactive compiler, one should have     shareglue.sml. Before building an interactive compiler, one should have
89     already gotten a visible compiler (for that particular architecture),     already gotten a visible compiler (for that particular architecture),
90     see the viscomp directory. To build a compiler for SPARC architecture,     see the viscomp directory. To build a compiler for SPARC architecture,
91     all we need to do is to load and run the IntSparc (in sparcglue.sml)     all we need to do is to load and run the IntSparc (in sparcglue.sml)
92     structure.     structure.
93  1-TopLevel/environ/  TopLevel/environ/
94     A top-level environment include static environment, dynamic environment     A top-level environment include static environment, dynamic environment
95     and symbolic environment. The definitions of static environments are in     and symbolic environment. The definitions of static environments are in
96     the 3-Semant/statenv directory, as they are mostly used by the elaboration     the Semant/statenv directory, as they are mostly used by the elaboration
97     and type checking.     and type checking.
98  1-TopLevel/interact/  TopLevel/interact/
99     How the top-level interactive loop is organized. The evalloop.sml contains     How the top-level interactive loop is organized. The evalloop.sml contains
100     the details on how a ML program is compiled from source code to binary     the details on how a ML program is compiled from source code to binary
101     code and then later being executed.     code and then later being executed.
102  1-TopLevel/main/  TopLevel/main/
103     The top-level compiler structure is shown in the compile.sig and     The top-level compiler structure is shown in the compile.sig and
104     compile.sml. The compile.sml contains details on how ML programs     compile.sml. The compile.sml contains details on how ML programs
105     are compiled into the FLINT intermediate format, but the details     are compiled into the FLINT intermediate format, but the details
106     on how FLINT gets compiled into the binary code segments are not     on how FLINT gets compiled into the binary code segments are not
107     detailed here, instead, they are described in the     detailed here, instead, they are described in the
108     4-FLINT/main/flintcomp.sml file. The CODEGENERATOR signature     FLINT/main/flintcomp.sml file. The CODEGENERATOR signature
109     in codes.sig defines the interface about this FLINT code generator.     in codes.sig defines the interface about this FLINT code generator.
110     Note: all the uses of the compilation facility goes throught the "compile"     Note: all the uses of the compilation facility goes throught the "compile"
111     function defined in the compile.sml. The common intermediate formats are     function defined in the compile.sml. The common intermediate formats are
112     stated in the compbasic.sig and compbasic.sml files. The version.sml     stated in the compbasic.sig and compbasic.sml files. The version.sml
113     defines the version numbers.     defines the version numbers.
114  1-TopLevel/viscomp/  TopLevel/viscomp/
115     How to build the visible compiler viscomp --- this is essentially     How to build the visible compiler viscomp --- this is essentially
116     deciding what to export to the outside world. All the Compiler     deciding what to export to the outside world. All the Compiler
117     control flags are defined in the control.sig and control.sml files     control flags are defined in the control.sig and control.sml files
118     placed in this directory.     placed in this directory.
119    
120  2-Parse/  Parse/
121     Phase 1 of the compilation process. Turning the SML source code into     Phase 1 of the compilation process. Turning the SML source code into
122     the Concrete Synatx. The definition of concrete syntax is in ast/ast.sml.     the Concrete Synatx. The definition of concrete syntax is in ast/ast.sml.
123     The frontend.sig and frontend.sml files in the main directory contain     The frontend.sig and frontend.sml files in the main directory contain
124     the big picture on the front end.     the big picture on the front end.
125    
126  3-Semant  Semant
127     This phase does semantic analysis, more specifically, it does the     This phase does semantic analysis, more specifically, it does the
128     elaboration (of concrete syntax into abstract syntax) and type-checking     elaboration (of concrete syntax into abstract syntax) and type-checking
129     of the core and module languages. The semantic objects are defined in     of the core and module languages. The semantic objects are defined in
130     main/bindings.sml. The result is the Abstract Syntax, defined the     main/bindings.sml. The result is the Abstract Syntax, defined the
131     main/absyn.sml file.     main/absyn.sml file.
132  3-Semant/basics/  Semant/basics/
133     Definition of several data structures and utility functions. They are     Definition of several data structures and utility functions. They are
134     used by the code that does semantic analysis. The env.sig and env.sml     used by the code that does semantic analysis. The env.sig and env.sml
135     files defines the underlying data structures used to represent  the     files defines the underlying data structures used to represent  the
136     static environment.     static environment.
137  3-Semant/elaborate/  Semant/elaborate/
138     How to turn a piece of code in the Concrete Syntax into one in the     How to turn a piece of code in the Concrete Syntax into one in the
139     Abstract Syntax. The top-level organization is in the following     Abstract Syntax. The top-level organization is in the following
140     elabtop.sml file.     elabtop.sml file.
141  3-Semant/main/absyn.sml  Semant/main/absyn.sml
142     Definition of Abstract Syntax     Definition of Abstract Syntax
143  3-Semant/main/bindings.sml  Semant/main/bindings.sml
144     Top-level view of what semantic objects we have     Top-level view of what semantic objects we have
145  3-Semant/main/elabtop.sml  Semant/main/elabtop.sml
146     Top-level view of the elaboration process. Notice that each piece     Top-level view of the elaboration process. Notice that each piece
147     of core-ML program is first translated into the Abstract Syntax,     of core-ML program is first translated into the Abstract Syntax,
148     and gets type-checked. The type-checking does change the contents     and gets type-checked. The type-checking does change the contents
149     of abstract syntax, as certain type information won't be known     of abstract syntax, as certain type information won't be known
150     until type-checking is done.     until type-checking is done.
151  3-Semant/modules/  Semant/modules/
152     Utility functions for elaborations of modules. The module.sig and     Utility functions for elaborations of modules. The module.sig and
153     module.sml contains the definitions of module-level semantic objects.     module.sml contains the definitions of module-level semantic objects.
154  3-Semant/pickle/  Semant/pickle/
155     How to write the static environments into a file! This is important     How to write the static environments into a file! This is important
156     if you want to create the *.bin file. It is also useful to infer     if you want to create the *.bin file. It is also useful to infer
157     a unique persistant id for each compilation unit (useful to detect     a unique persistant id for each compilation unit (useful to detect
158     the cut-off compilation dependencies).     the cut-off compilation dependencies).
159  3-Semant/statenv/  Semant/statenv/
160     The definition of Static Environment. The SC-ed version of Static     The definition of Static Environment. The CM-ed version of Static
161     Environment is used to avoid environment blow-up in the pickling.     Environment is used to avoid environment blow-up in the pickling.
162     The prim.sml contains the list of primitive operators and primitive     The prim.sml contains the list of primitive operators and primitive
163     types exported in the initial static environment (i.e., PrimEnv).     types exported in the initial static environment (i.e., PrimEnv).
164     During bootstrapping, PrimEnv is the first environment you have to     During bootstrapping, PrimEnv is the first environment you have to
165     set up before you can compile files in the 0-Boot directory.     set up before you can compile files in the Boot directory.
166  3-Semant/types/  Semant/types/
167     This directory contains all the data structures and utility functions     This directory contains all the data structures and utility functions
168     used in type-checking the Core-ML language.     used in type-checking the Core-ML language.
169  3-Semant/typing/  Semant/typing/
170     The type-checking and type-inference code for the core-ML programs.     The type-checking and type-inference code for the core-ML programs.
171     It is performed on Abstract Syntax and it produces Abstract Syntax     It is performed on Abstract Syntax and it produces Abstract Syntax
172     also.     also.
173    
174  4-FLINT  FLINT
175     This phase translates the Abstract Syntax into the intermediate     This phase translates the Abstract Syntax into the intermediate
176     Lambda language (i.e., FLINT). During the translation, it compiles     Lambda language (i.e., FLINT). During the translation, it compiles
177     the Pattern Matches (see the mcomp directory). Then it does a bunch     the Pattern Matches (see the mcomp directory). Then it does a bunch
178     of optimizations on FLINT; then it does representation analysis,     of optimizations on FLINT; then it does representation analysis,
179     and it converts the FLINT code into CPS, finally it does closure     and it converts the FLINT code into CPS, finally it does closure
180     conversion.     conversion.
181  4-FLINT/clos/  FLINT/clos/
182     The closure conversion step. Check out Shao/Appel LFP94 paper for     The closure conversion step. Check out Shao/Appel LFP94 paper for
183     the detailed algorithm.     the detailed algorithm.
184  4-FLINT/cps/  FLINT/cps/
185     Definition of CPS plus on how to convert the FLINT code into the     Definition of CPS plus on how to convert the FLINT code into the
186     CPS code. The compilation of the Switch statement is done in this     CPS code. The compilation of the Switch statement is done in this
187     phase.     phase.
188  4-FLINT/cpsopt/  FLINT/cpsopt/
189     The CPS-based optimizations (check Appel's "Compiling with     The CPS-based optimizations (check Appel's "Compiling with
190     Continuations" book for details). Eventually, all optimizations     Continuations" book for details). Eventually, all optimizations
191     in this directory will be migrated into FLINT.     in this directory will be migrated into FLINT.
192  4-FLINT/flint/  FLINT/flint/
193     This directory defines the FLINT language. The detailed definitions     This directory defines the FLINT language. The detailed definitions
194     of primitive tycs, primitive operators, kinds, type constructors,     of primitive tycs, primitive operators, kinds, type constructors,
195     and types are in the 4-FLINT/kernel directory.     and types are in the FLINT/kernel directory.
196  4-FLINT/kernel/  FLINT/kernel/
197     Definiton of the kernel data structures used in the FLINT language.     Definiton of the kernel data structures used in the FLINT language.
198     This includes: deBruijn indices, primitive tycs, primitive operators,     This includes: deBruijn indices, primitive tycs, primitive operators,
199     FLINT kinds, FLINT constructors, and FLINT types. When you write     FLINT kinds, FLINT constructors, and FLINT types. When you write
200     code that manipulates the FLINT code, please restrict yourself to     code that manipulates the FLINT code, please restrict yourself to
201     use the functions defined in the LTYEXTERN interface only.     use the functions defined in the LTYEXTERN interface only.
202  4-FLINT/main/  FLINT/main/
203     The flintcomp.sml describes how the FLINT code gets compiled into     The flintcomp.sml describes how the FLINT code gets compiled into
204     the optimized and closure-converted CPS code (eventually, it should     the optimized and closure-converted CPS code (eventually, it should
205     produce optimized, closure-converted, adn type-safe FLINT code).     produce optimized, closure-converted, adn type-safe FLINT code).
206  4-FLINT/opt/  FLINT/opt/
207     The FLINT-based optimizations, such as contraction, type     The FLINT-based optimizations, such as contraction, type
208     specializations, etc.     specializations, etc.
209  4-FLINT/plambda/  FLINT/plambda/
210     An older version of the Lambda language (not in the A-Normal form)     An older version of the Lambda language (not in the A-Normal form)
211  4-FLINT/reps/  FLINT/reps/
212     Code for performing the representation analysis on FLINT     Code for performing the representation analysis on FLINT
213  4-FLINT/trans/  FLINT/trans/
214     Translation of Abstract Syntax into the PLambda code, then to the FLINT     Translation of Abstract Syntax into the PLambda code, then to the FLINT
215     code. All semantic objects used in the elaboration are translated into     code. All semantic objects used in the elaboration are translated into
216     the FLINT types as well. The translation phase also does match     the FLINT types as well. The translation phase also does match
217     compilation. The translation from PLambda to FLINT does the (partial)     compilation. The translation from PLambda to FLINT does the (partial)
218     type-based argument flattening.     type-based argument flattening.
219    
220  5-CodeGen/alpha32/  CodeGen/alpha32/
221     Alpha32 new code generator     Alpha32 new code generator
222  5-CodeGen/alpha32x/  CodeGen/alpha32x/
223     Alpha32 new code generator (with special patches)     Alpha32 new code generator (with special patches)
224  5-CodeGen/cpscompile/  CodeGen/cpscompile/
225     Compilation of CPS into the MLRISC abstract machine code     Compilation of CPS into the MLRISC abstract machine code
226  5-CodeGen/hppa/  CodeGen/hppa/
227     HPPA new code genrator     HPPA new code genrator
228  5-CodeGen/main/  CodeGen/main/
229     The big picture of the codegenerator; including important     The big picture of the codegenerator; including important
230     files on machine specifications and runtime tagging schemes.     files on machine specifications and runtime tagging schemes.
231    
232  6-OldCGen  OldCGen
233     The old code generator. May eventually go away after Lal's new     The old code generator. May eventually go away after Lal's new
234     code generator becomes stable on all platforms. Each code generator     code generator becomes stable on all platforms. Each code generator
235     should produce a structure of signature CODEGENERATOR (defined in     should produce a structure of signature CODEGENERATOR (defined in
236     the 1-Toplevel/main/codes.sig file).     the Toplevel/main/codes.sig file).
237  6-OldCGen/coder/  OldCGen/coder/
238     This directory contains the machine-independent parts of the     This directory contains the machine-independent parts of the
239     old code generator. Some important signatures are also here.     old code generator. Some important signatures are also here.
240  6-OldCGen/cpsgen/  OldCGen/cpsgen/
241     Compilation of CPS into the abstract machine in the old code     Compilation of CPS into the abstract machine in the old code
242     generator. Probably the spill.sml and limit.sml files should     generator. Probably the spill.sml and limit.sml files should
243     not be placed here. A counterpart of this in the new     not be placed here. A counterpart of this in the new
244     code generator is the 6-NewCGen/cpscompile directory.     code generator is the NewCGen/cpscompile directory.
245  6-OldCGen/mips/  OldCGen/mips/
246     MIPS code generator for both little endian and big endian     MIPS code generator for both little endian and big endian
247  6-OldCGen/rs6000/  OldCGen/rs6000/
248     RS6000 code generator     RS6000 code generator
249  6-OldCGen/sparc/  OldCGen/sparc/
250     SPARC code generator     SPARC code generator
251  6-OldCGen/x86/  OldCGen/x86/
252     X86 code generator     X86 code generator
253    
254  7-MLRISC  MLRISC
255     Lal George's new code generator generator (MLRISC).     Lal George's new MLRISC based code generators (MLRISC).
256    
257  9-MiscUtil/  MiscUtil/
258     Contains various kinds of utility programs     Contains various kinds of utility programs
259  9-MiscUtil/bignums/  MiscUtil/bignums/
260     Bignum packages. I have no clue how stable this is.     Bignum packages. I have no clue how stable this is.
261  9-MiscUtil/fixityparse  MiscUtil/fixityparse
262  9-MiscUtil/lazycomp  MiscUtil/lazycomp
263     Some code for implementation of the lazy evaluation primitives.     Some code for implementation of the lazy evaluation primitives.
264  9-MiscUtil/print/  MiscUtil/print/
265     Pretty printing. Very Adhoc, needs major clean up.     Pretty printing. Very Adhoc, needs major clean up.
266  9-MiscUtil/profile/  MiscUtil/profile/
267     The time and the space profiler.     The time and the space profiler.
268  9-MiscUtil/util/  MiscUtil/util/
269     Important utility functions including the Inputsource (for     Important utility functions including the Inputsource (for
270     reading in a program), and various Hashtable and Dictionary     reading in a program), and various Hashtable and Dictionary
271     implementations.     implementations.
272    
273  ============================================================================  ============================================================================
274  A. SUMMARY:  A. SUMMARY of PHASES:
275    
276  0. statenv   : symbol -> binding  0. statenv   : symbol -> binding
277     dynenv    : pid -> object     dynenv    : pid -> object
# Line 304  Line 283 
283  5. OldCGen   : CPS -> csegments (spilling, limit check, codegen)  5. OldCGen   : CPS -> csegments (spilling, limit check, codegen)
284    
285  ============================================================================  ============================================================================
286  B. How to recover the all-files.cm (or sources.cm) file after making  B. CREATING all-files.cm
287    
288       How to recover the all-files.cm (or sources.cm) file after making
289     dramatic changes to the directory structure. Notice that the difference     dramatic changes to the directory structure. Notice that the difference
290     between all-files.cm and sources.cm is just the bootstrap glue files.     between all-files.cm and sources.cm is just the bootstrap glue files.
291    
292     1. ls -1 [1-6,9]*/*/*.{sig,sml} | grep -i -v glue | grep -v obsol > xxx     1. ls -1 [TopLevel,Parse,Semant,FLINT,CodeGen,OldCGen,MiscUtil]*/*/*.{sig,sml} \
293     2. Add 7-MLRISC/MLRISC.cm          | grep -i -v glue | grep -v obsol > xxx
294     3. Fix ml.lex.* and ml.grm.* files     2. Add ../MLRISC/MLRISC.cm
295     4. Add 9-MiscUtil/util/UTIL.cm     3. remove ml.lex.* and ml.grm.* files
296       4. Add ../comp-lib/UTIL.cm
297     5. Add ../ml-yacc/lib/sources.cm     5. Add ../ml-yacc/lib/sources.cm
    6. Delete 9-MiscUtil/util/intmap.sig  
              9-MiscUtil/util/intmap.sml  
              9-MiscUtil/util/sort.sml  
              9-MiscUtil/util/sortedlist.sml  
298  ============================================================================  ============================================================================

Legend:
Removed from v.69  
changed lines
  Added in v.93

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0