473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Mode Oriented Lexical Analyser Generator

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

Aug 8 '06 #1
2 2299
"Frank-René Schäfer" <fr**************@gmx.netwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
: 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.

How does quex compare to existing and broadly used
solutions such as flex or boost::spirit ?
[ I use flex, and it does support modes.
Indentation is no big deal to support as a single pattern
like <line_start>[\t ]* --check length of result ]

Regards,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Aug 8 '06 #2
Quex provides nice handling of lexer modes. In flex modes can only be
inclusive or exclusive. Quex provides 'real' inheritance
relationships. That is, you can have for example a mode COMMON for the
detection of comments and EndOfFile. This mode does what is always to
be done in such cases. Then different modes such as 'ALGORITHM' or
'FORMAT_STRING' can derive from this mode, thus inheriting this
behavior and *ensuring* that also these modes behave according to
COMMON. This reduces code duplication and makes the functionality very
transparent.

Also, quex provides the ability to define event handlers for mode
transitions and the indentation event. For more features, see the
documentation which is downloadable from http://quex.sf.net.

Quex still uses flex to produce the 'core' engine. This has the
advantage that intermediate files can be used as a bases to work with
flex, if your boss wants to rely on traditional tools. There is some
work in progress, though, to develop a new engine generator which is
more suited for unicode handling.

Best Regards

Frank.

Aug 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Guyon Morée | last post by:
what is the difference? if I open a text file in binary (rb) mode, it doesn't matter... the read() output is the same.
0
by: Collin VanDyck | last post by:
Hello! I have set up a pluggable SAX transformation pipeline which is made up of individual nodes that transform the source XML, and for the most part it works well. Each node in the pipeline...
4
by: bariole | last post by:
Hi I am trying to make lexical analysis of some simplified html code with flex tool. However that kind of work is new to me and I don't know where to start. I have searched a web but I didn't...
13
by: Lucas Zimmerman | last post by:
Is there any Lex code available that describes how to scan C programs? I'd like to read someting related to this. One of my doubs is how C deals with ambiguities, for example, `a = x/*p;' or `a =...
18
by: jslowery | last post by:
I am not completely knowledgable about the status of lexical scoping in Python, but it was my understanding that this was added in a long time ago around python2.1-python2.2 I am using python2.4...
6
by: enaeher | last post by:
I would expect this code: globalFnArray = ; for (var i = 0; i < 5; i++) { globalFnArray.push (function () { alert (i) }); } for (var j = 0; j < 5; j++) { globalFnArray(); } to alert 0, 1, 2,...
0
by: johan degraeve | last post by:
Hello, Put sqlsvr 2000 into single user mode (startup parameter -m added, server restarted, says it's in single mode) used query analyser to run the following: dbcc checkdb...
14
by: Khookie | last post by:
Woah... is it just me or do C programmers don't bother talking about how cool C can be (compared to Lisp, Haskell, etc.) - functionally speaking? // Lexical scoping - via nested functions...
3
by: globalrev | last post by:
i cant figure outif python has lexical or general scope. it seems functions have lexical scope but with some restrictions and some non-function scopes are dynamic?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.