473,583 Members | 3,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(ato i(Lexeme));
"=" =TKN_ASSIGNMENT ;
}

Aug 8 '06 #1
2 2320
"Frank-René Schäfer" <fr************ **@gmx.netwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.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
10469
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
1452
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 is assigned a ContentHandler and a LexicalHandler by the transformation framework. Each node in the pipeline may either be: * a class that...
4
4395
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 find anything useful. I found tools like LEXHTML.CXX library but I have no need for that. What I need is simple overview of working ideas of most...
13
1943
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 = x//*...*/-3;' (considering c99's `//'). thanks in advance, n.
18
1784
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 and the following code throws a "status variable" not found in the inner-most function, even when I try to "global" it. def collect(fields,...
6
2028
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, 3, and 4. Instead, I get 5, 5, 5, 5, and 5 in Firefox, indicating that all of
0
1814
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 'atimowork2',REPAIR_ALLOW_DATA_LOSS query analyser reports the error that database must be in single user mode while it is? Can anyone help, please, because I have...
14
2167
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 #include <stdio.h> int main() { int x = 10;
3
8786
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
7896
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8184
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8328
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5375
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3820
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.