File: README

package info (click to toggle)
smlnj 110.79-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 82,564 kB
  • sloc: ansic: 32,532; asm: 6,314; sh: 2,296; makefile: 1,821; perl: 1,170; pascal: 295; yacc: 190; cs: 78; python: 77; lisp: 19
file content (101 lines) | stat: -rw-r--r-- 2,695 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
ckit, a front end for C in SML
Version 1.0, 31 Mar 2000
------------------------------

0. Contact information
----------------------

   ckit mailing list: ckit@mailman.cs.uchicago.edu
   Dave MacQueen: dbm@cs.uchicago.edu
   Nevin Heintze: nch@google.com


1. How to build it
------------------

Let CKIT be the directory containing the CKit code.
Run SML in directory $CKIT/ast.
Execute "CM.make();".  This gives you the parser/elaborator.


2. How to use it
----------------
Top level driving functions are in file parse-to-ast.sml.  Generally
use ParseToAst.fileToAst.  It returns a record of type BuildAst.ProgramInfo.

Example:

  val {ast: Ast.ast,
       tidtab: Bindings.tidBinding Tidtab.uidtab,
       errorCount: int,
       warningCount: int,
       auxiliaryInfo: {aidtab: Tables.aidtab,
		       implicits: Tables.aidtab,
                       env: State.symtab}}
      = ParseToAst.fileToAst ("file");

Ast.ast is the abstract syntax type for translation units (a list of top-level
C declarations).  For further information, read the code.

To get ahold of parse trees (parser/parse-tree.sml), which is the raw data
structure produced by the parser:

  val errorState : Error.errorState = Error.mkErrState TextIO.stdOut;
  val parseTree : ParseTree.externalDecl list =
      Parser.parseFile errorState "file";

See parse/util/error.sml for the definition of the errorState type.


3. Directory map
----------------

parser/
  parser-tree-sig.sml, parser-tree.sml: definition of parse tree types
  grammar/
    lex and yacc specifications
  util/
    sourcemap-sig.sml, sourcemap.sml: mapping source file locations
    error-sig.sml, error.sml: error reporting functions
ast/
  ast-sig.sml, ast.sml: definition of abstract syntax types
  build-ast.sml:
    translation from parse trees to abstract syntax, with type checking and other
    static semantics processing
  pp/* : pretty printing for ast
  extensions/
    c/  -- dummy extension structures for C
variants/
  ansic/
    config.sml: various flags controlling error checking, type checking, etc.
ast-utils/
  copy/
    copying ast types
  equality/
    equality for ast types
  simplifier/
    ast simplifier


4. Notes:

4.1 Pretty printing - suppressing underscores

You can suppress underscores in pretty-printing using:

  PPLib.suppressPidUnderscores := true;
  PPLib.suppressTidUnderscores := true;

4.2 ast-util

Much of this code is suspect and needs revision.


5. Todo:

5.1. Implement checks on casts.
     - explicit casts currently allow any change of type;
       instead they should only allow permitted conversions.

-----------------------------------------------------------------------------------