]>
Commit | Line | Data |
---|---|---|
bac41a7b A |
1 | (RCS control information is at the end of this file.) |
2 | ||
3 | ||
4 | README: snacc compiler source code - Mike Sample 92 | |
5 | ---------------------------------------------------- | |
6 | ||
7 | ||
8 | Compiling the snacc compiler | |
9 | ---------------------------- | |
10 | ||
11 | The snacc source code can be compiled with ANSI and non-ANSI C | |
12 | compilers. The configure script automatically determines the type of | |
13 | your C compiler and defines __USE_ANSI_C__ accordingly. | |
14 | ||
15 | If you use lex, you should change the YYLMAX value in the lex | |
16 | generated lex-asn1.c file from its measly default value (200 or so) to | |
17 | something like 2048. YYLMAX is the longest token that the lexical | |
18 | analyzer can match. I found this problem when snacc choked on the | |
19 | DESCRIPTION field of an OBJECT-TYPE macro that was longer than 200 | |
20 | characters. GNU flex does not have this problem (and seems to produce | |
21 | smaller code than the old lex). | |
22 | ||
23 | Compiling parse-asn1.y with bison or yacc will produce 61 shift/reduce | |
24 | errors and 2 reduce/reduce errors. These are mostly due to the macros | |
25 | that are parsed. The reduce/reduce errors result from type or value | |
26 | lists in some macros - the a "NULL" value and "NULL" type are both | |
27 | represented by "NULL" - don't worry about this ambiguity. Bizzare | |
28 | syntax errors that arise from these shift-reduce errors can be | |
29 | handled by separating types/values with semi-colons. | |
30 | ||
31 | The length of generated files' names will be truncated to match your | |
32 | system has the posix "pathconf" routine. If it does not the maximum | |
33 | file length will be set at 14 chars. If you want to change this, | |
34 | modify the "MakeBaseFileName" routine in back_ends/c_gen/str_util.c or | |
35 | use the -mf cmd line option. | |
36 | ||
37 | snacc has been successfully installed on SPARCs, HP700s, RS 6000s, and | |
38 | MIPS machines. You may have to fiddle with system include files. | |
39 | ||
40 | Outline of what snacc does | |
41 | -------------------------- | |
42 | ||
43 | The snacc compiler uses yacc and lex (or bison/flex) parser to produce | |
44 | an attributed parse tree for an ASN.1 source file. The main steps of | |
45 | the snacc are (see main() in core/snacc.c): | |
46 | ||
47 | ||
48 | 1. parse USEFUL types module (if given on command line with -u option) | |
49 | related src: core/snacc.c core/lex-asn1.l core/parse-asn1.y | |
50 | core/asn1module.h | |
51 | ||
52 | 2. parse the ASN.1 source file(s) | |
53 | related src: core/snacc.c core/lex-asn1.l core/parse-asn1.y | |
54 | core/asn1module.h | |
55 | ||
56 | 3. link import and local type references to the type proper | |
57 | definitions in the parsed modules (including useful types module). | |
58 | related src: core/link_types.c | |
59 | ||
60 | 4. do parsing for OBJECT IDENTIFIER values. Simple recursive descent | |
61 | parser. Could be expanded to handle more complex values. | |
62 | related src: core/val_parser.c | |
63 | ||
64 | 5. link any value references (some may be internal to OBJECT IDENTIFIERs) | |
65 | related src: core/link_values.c | |
66 | ||
67 | 6. process macros - change type definitions in the macros to separate | |
68 | type definitions and do systemd dependent processing. | |
69 | related src: core/do_macros.c | |
70 | ||
71 | 7. normalize types and values - eg swap COMPONENTS OF and SELECTION types | |
72 | for actual types/field. (and more) | |
73 | related src: core/normalize.c | |
74 | ||
75 | 8. mark recursive type and report any recursion related errors. | |
76 | (e.g. empty recursive types A ::= B B ::= A) | |
77 | related src: core/recursive.c | |
78 | ||
79 | 9. check for sematic errors in each ASN.1 module. | |
80 | related src: core/err_chk.c | |
81 | ||
82 | 10. fill in the C or C++ type and routine naming information. | |
83 | (done before dependency sorting so the sorter can make | |
84 | decisions on the basis of whether a type is ref'd by pointer | |
85 | (last resort)) | |
86 | related src: back_ends/c++_gen/c++_types.c | |
87 | back_ends/c++_gen/c++_rules.c | |
88 | back_ends/c_gen/types_info.c | |
89 | back_ends/c_gen/rules.c | |
90 | ||
91 | 11. do type dependency sorting. Ordered from least dependent | |
92 | to most dependent. Saves some irritations in the C/C++ code. | |
93 | related src: core/dependency.c | |
94 | ||
95 | 12. Generate C/C++ .h and .c/.C files | |
96 | related src: core/snacc.c back_ends/* | |
97 | ||
98 | #------------------------------------------------------------------------------- | |
a66d0d4a | 99 | # $Header: /cvs/root/Security/SecuritySNACCRuntime/compiler/Attic/README,v 1.1.1.1 2001/05/18 23:14:08 mb Exp $ |
bac41a7b A |
100 | # $Log: README,v $ |
101 | # Revision 1.1.1.1 2001/05/18 23:14:08 mb | |
102 | # Move from private repository to open source repository | |
103 | # | |
104 | # Revision 1.1.1.1 1999/03/16 18:06:38 aram | |
105 | # Originals from SMIME Free Library. | |
106 | # | |
107 | # Revision 1.2 1994/09/01 01:37:51 rj | |
108 | # document the changes: | |
109 | # - autoconf stuff | |
110 | # - filename changes. | |
111 | # |