summaryrefslogtreecommitdiff
path: root/TAO/CIAO/CIDLC/parser_examples/README
blob: df0a141b2cc53515716951bac0a138d51e63b499 (plain)
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
// $Id$

                                  Parser Examples

This directory contains examples of a (C)IDL parser hierarchy using Spirit. Each
example (IDL2, IDL3 and CIDL) is in its own directory and has its own test file.
The Spirit files (these examples were compiled using Spirit 1.6.0) should be
unpacked so the directory spirit-1.6.0 is in the CIDLC directory. The builds
include too many files from Spirit to check them into the respository individually,
at least right now, but it is easy enough to download Spirit and unpack it. It
can be obtained at

http://spirit.sourceforge.net/

Spirit 1.6.0 can be downloaded along with the necessary parts of Boost 1.30.0.

All I have at the moment are MSVC 7.1 solution and project files. Makefiles will
be forthcoming, or interested parties can contribute them ;-).

*****************************************************************

To use mwc, make sure you have the environment variable

  SPIRIT_DIR

defined to point to the location where Spirit library is available,
and generate  using one of the following:

MSVC6:  mwc -type vc6
MSVC7:  mwc -type vc7
UNIX:   mwc

*****************************************************************


Uncommenting

#define SPIRIT_DEBUG

at the top of any driver file and recompiling will cause debug info to be
generated as the test file is parsed.

Each grammar file embeds the one it is a superset of. Some rules are overridden
in the superset grammar as necessary. As Boris suggests, we could create members
in superset grammars that are assigned references to rules from subset grammars,
thus enabling us to eliminate constructs like

idl3.idl2.*

and so forth, although I think it may be informative sometimes to see at a
glance which grammar a rule originates from. It will also be possible to
compile each grammar into a DLL, but so much of the code is template-based that
I'm not sure it will be worth it. I welcome suggestions and opinions about these
issues.

The CIDL grammar is incomplete, including only the rules underneath
'composition'. We are using at present a much smaller subset than that, but it
was convenient to implement composition's subrules down to the terminals.

The IDL2 grammar header file contains a simple utility parse() method derived
from the Spirit C grammar example. There is also a simple grammar for skipping
whitespace and comments, as well as #line and #pragma directives. All of these
features will need to be made more industrial-strength, and of course there
are many additional features that will need to be added - #includes,
error processing, etc. etc.


Jeff Parsons

4/8/03