Mode Oriented Lexical Analyser Generator

"Frank" <frank_r_schaefer@gmx.net>
9 Aug 2006 00:01:39 -0400

          From comp.compilers

Related articles
Mode Oriented Lexical Analyser Generator frank_r_schaefer@gmx.net (Frank) (2006-08-09)
| List of all articles for this month |

From: "Frank" <frank_r_schaefer@gmx.net>
Newsgroups: comp.compilers
Date: 9 Aug 2006 00:01:39 -0400
Organization: Compilers Central
Keywords: lex, available

OpenSource 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;
}



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.