SCM Repository
Annotation of /sml/releases/release-110.30/ckit/README
Parent Directory
|
Revision Log
Revision 719 - (view) (download)
1 : | dbm | 597 | ckit, a front end for C in SML |
2 : | Version 1.0, 31 Mar 2000 | ||
3 : | ------------------------------ | ||
4 : | |||
5 : | 0. Contact information | ||
6 : | ---------------------- | ||
7 : | |||
8 : | ckit mailing list: ckit@research.bell-labs.com | ||
9 : | Nevin Heintze: nch@research.bell-labs.com | ||
10 : | Dino Oliva: oliva@research.nj.nec.com | ||
11 : | Dave MacQueen: dbm@research.bell-labs.com | ||
12 : | |||
13 : | |||
14 : | 1. How to build it | ||
15 : | ------------------ | ||
16 : | |||
17 : | Let CKIT be the directory containing the CKit code. | ||
18 : | Run SML in directory $CKIT/ast. | ||
19 : | Execute "CM.make();". This gives you the parser/elaborator. | ||
20 : | |||
21 : | |||
22 : | 2. How to use it | ||
23 : | ---------------- | ||
24 : | Top level driving functions are in file parse-to-ast.sml. Generally | ||
25 : | use ParseToAst.fileToAst. It returns a record of type BuildAst.ProgramInfo. | ||
26 : | |||
27 : | Example: | ||
28 : | |||
29 : | val {ast: Ast.ast, | ||
30 : | tidtab: Bindings.tidBinding Tidtab.uidtab, | ||
31 : | errorCount: int, | ||
32 : | warningCount: int, | ||
33 : | auxiliaryInfo: {aidtab: Tables.aidtab, | ||
34 : | implicits: Tables.aidtab, | ||
35 : | env: State.symtab}} | ||
36 : | = ParseToAst.fileToAst ("file"); | ||
37 : | |||
38 : | Ast.ast is the abstract syntax type for translation units (a list of top-level | ||
39 : | C declarations). For further information, read the code. | ||
40 : | |||
41 : | To get ahold of parse trees (parser/parse-tree.sml), which is the raw data | ||
42 : | structure produced by the parser: | ||
43 : | |||
44 : | val errorState : Error.errorState = Error.mkErrState TextIO.stdOut; | ||
45 : | val parseTree : ParseTree.externalDecl list = | ||
46 : | Parser.parseFile errorState "file"; | ||
47 : | |||
48 : | See parse/util/error.sml for the definition of the errorState type. | ||
49 : | |||
50 : | |||
51 : | 3. Directory map | ||
52 : | ---------------- | ||
53 : | |||
54 : | parser/ | ||
55 : | parser-tree-sig.sml, parser-tree.sml: definition of parse tree types | ||
56 : | grammar/ | ||
57 : | lex and yacc specifications | ||
58 : | util/ | ||
59 : | sourcemap-sig.sml, sourcemap.sml: mapping source file locations | ||
60 : | error-sig.sml, error.sml: error reporting functions | ||
61 : | ast/ | ||
62 : | ast-sig.sml, ast.sml: definition of abstract syntax types | ||
63 : | build-ast.sml: | ||
64 : | translation from parse trees to abstract syntax, with type checking and other | ||
65 : | static semantics processing | ||
66 : | pp/* : pretty printing for ast | ||
67 : | extensions/ | ||
68 : | c/ -- dummy extension structures for C | ||
69 : | variants/ | ||
70 : | ansic/ | ||
71 : | config.sml: various flags controlling error checking, type checking, etc. | ||
72 : | ast-utils/ | ||
73 : | copy/ | ||
74 : | copying ast types | ||
75 : | equality/ | ||
76 : | equality for ast types | ||
77 : | simplifier/ | ||
78 : | ast simplifier | ||
79 : | |||
80 : | |||
81 : | 4. Notes: | ||
82 : | |||
83 : | 4.1 Pretty printing - suppressing underscores | ||
84 : | |||
85 : | You can suppress underscores in pretty-printing using: | ||
86 : | |||
87 : | PPLib.suppressPidUnderscores := true; | ||
88 : | PPLib.suppressTidUnderscores := true; | ||
89 : | |||
90 : | 4.2 ast-util | ||
91 : | |||
92 : | Much of this code is suspect and needs revision. | ||
93 : | |||
94 : | |||
95 : | 5. Todo: | ||
96 : | |||
97 : | 5.1. Implement checks on casts. | ||
98 : | - explicit casts currently allow any change of type; | ||
99 : | instead they should only allow permitted conversions. | ||
100 : | |||
101 : | ----------------------------------------------------------------------------------- | ||
102 : |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |