read.me
资源名称:parse.tar.Z [点击查看]
上传用户:hbdengju
上传日期:2007-01-06
资源大小:11k
文件大小:1k
源码类别:
编译器/解释器
开发平台:
C/C++
- 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.