vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | WHAT TO READ? |
| 2 | ============= |
| 3 | |
| 4 | For quick installation tips read INSTALL. |
| 5 | |
| 6 | For more complete documentation on this compiler and on using the |
| 7 | results of compilation please look into ./doc directory. |
| 8 | |
vlm | d79b30d | 2004-09-05 10:41:23 +0000 | [diff] [blame] | 9 | Please also read the FAQ file. |
| 10 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 11 | An excellent book on ASN.1 is written by Olivier Dubuisson: |
| 12 | "ASN.1 Communication between heterogeneous systems", ISBN:0-12-6333361-0. |
| 13 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 14 | QUICK START |
| 15 | =========== |
| 16 | |
| 17 | After building [and installing] the compiler (see INSTALL), you may use |
| 18 | the asn1c command to compile the ASN.1 specification: |
| 19 | |
vlm | d79b30d | 2004-09-05 10:41:23 +0000 | [diff] [blame] | 20 | asn1c <module.asn1> |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 21 | |
| 22 | If several specifications contain interdependencies, all of them must be |
| 23 | specified: |
| 24 | |
vlm | d79b30d | 2004-09-05 10:41:23 +0000 | [diff] [blame] | 25 | asn1c <module1.asn1> <module2.asn1> ... |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 26 | |
| 27 | The ./examples directory contains several ASN.1 modules and a script to |
| 28 | extract ASN.1 modules from RFC documents. To compile X.509 PKI module: |
| 29 | |
| 30 | ./asn1c/asn1c -P ./examples/*PKIX*93*.asn1 |
| 31 | |
| 32 | In this example, -P option is used to instruct the compiler to print the |
| 33 | compiled text on the standard output instead of creating multiple .c |
vlm | d79b30d | 2004-09-05 10:41:23 +0000 | [diff] [blame] | 34 | and .h files for every ASN.1 type found inside the specified ASN.1 modules. |
| 35 | This is useful for debugging and test automation. |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 36 | |
| 37 | The compiler -E and -EF options are used for testing the parser and |
| 38 | the semantic fixer, respectively. These options will instruct the compiler |
| 39 | to dump out the parsed (and fixed) ASN.1 specification as it was |
| 40 | "understood" by the compiler. It might be useful for checking |
| 41 | whether a particular syntactic construction is properly supported |
| 42 | by the compiler. |
| 43 | |
vlm | d79b30d | 2004-09-05 10:41:23 +0000 | [diff] [blame] | 44 | asn1c -EF <module-to-test.asn1> |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 45 | |
| 46 | |
| 47 | MODEL OF OPERATION |
| 48 | ================== |
| 49 | |
| 50 | The asn1c compiler works by processing the ASN.1 module specification |
| 51 | in several stages: |
| 52 | 1. In the first stage, the ASN.1 file is parsed. |
vlm | d79b30d | 2004-09-05 10:41:23 +0000 | [diff] [blame] | 53 | (Parsing produces an ASN.1 syntax tree for the subsequent levels) |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 54 | 2. In the second stage, the syntax tree is "fixed". |
vlm | d79b30d | 2004-09-05 10:41:23 +0000 | [diff] [blame] | 55 | (Fixing is a process of checking the tree for semantic errors, |
| 56 | accompanied by the tree transformation into the canonical form) |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 57 | 3. In the third stage, the syntax tree is compiled into the target language. |
| 58 | |
| 59 | There are several command-line options reserved for printing the results |
| 60 | after each stage of operation: |
| 61 | |
| 62 | <parser> => print (-E) |
| 63 | <parser> => <fixer> => print (-E -F) |
| 64 | <parser> => <fixer> => <compiler> => print (-P) |
| 65 | <parser> => <fixer> => <compiler> => save-compiled [default] |
| 66 | |
| 67 | |
| 68 | -- |
| 69 | Lev Walkin |
| 70 | vlm@lionet.info |