DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ R T

⟦603a9e8d4⟧ TextFile

    Length: 1897 (0x769)
    Types: TextFile
    Names: »README«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/clex/README« 

TextFile


C++ Lexical Scanner (in C++)

Following this note is a shar-format file containing a
lexical scanner for C++.  Use it however you like.  It
should be adequate to drop into a full compiler.
For such a use, error reporting would probably need 
some refinement.  Also, if the compiler was to have
a built-in preprocessor (i.e. not using cpp) the handler
for "#" lines would need a bit of work.

I will be interested in bug reports, significant improvements.
Nathan Myers   tektronix!sequent!mntgfx!nmyers

The following source files are included:

    clex.c
    clex.h
    clex_sym.h
    clex_test.c
    kwhash.c
    Makefile

They implement a self-contained lexical scanner class for C++.
It is extensible by derivation primarily in the area of
processing "#" compiler directives (currently, it only
interprets the "#line" construct).

It has one other degree of flexibility, in its handling
of bracket-enclosed expressions "[]".  These may be treated
as a normal sequence of tokens or as delimited strings;
the former is of greater use in a traditional parser, while
the latter is favored for extraction of declarations by
a code browser.

To allay some confusion, I should point out here that
clex_sym.h is used in an unusual way: it is included
twice in the module clex.c; once for declaration
part, once for the (static) definition part.  It is
built this way to keep all knowledge of keywords
in a single place.

The file kwhash.c is a standard C standalone program used
to arrive at the collision-free hash function used to
recognize C++ keywords.  Any new keyword stands about
one chance in 3 of colliding with an existing keyword,
thus requiring that a new hash function be generated.

The file clex_test.c compiles to a program which reads
C or C++ code from standard input and emits token names
on the standard output.  Try it with different values
in the constructor's second argument.