penSource Project 'Quex': http://quex.sf.net
Last weekend, the lexical analyser generator 'Quex' has been released
on SourceForge. Quex provides advanced features for mode definitions
and event handling. Among its features are
-- Creation of a complete C++ environment for lexical analyser
engines.
-- Modes management:
-- mode transitions can be restricted (e.g. "disallow mode A
to enter any mode but F, and G")
-- mode transition events can be equipped with event handlers.
-- modes can be inherited from each other
(thus overtaking pattern-action pairs and event handlers)
-- The indentation event facilitating lexical analysis for
indentation based languages.
For simple lexical analyser, quex provides convinient shorthands. The
mode definition of a lexical anylser for language consisting of
'print', a identifier, number, and assignment can be defined in few
lines as follows:
mode SOME_MODE {
"print" =TKN_PRINT;
[_a-z]+ =TKN_IDENTIFIER(Lexeme);
[0-9]+ =TKN_NUMBER(atoi(Lexeme));
"=" =TKN_ASSIGNMENT;
}