473,221 Members | 2,048 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,221 software developers and data experts.

Writting a lexer program in C++

Hello every one..

I am planning to make a lexcial analyzer in C++, the keywords, opertators etc for the language that the lexer would take lexmes from are all given to us as a set of requirements.

I wanted to know how do i go about making this..


Thanks

Ap
Jul 10 '07 #1
6 4387
Silent1Mezzo
208 100+
Hello every one..

I am planning to make a lexcial analyzer in C++, the keywords, opertators etc for the language that the lexer would take lexmes from are all given to us as a set of requirements.

I wanted to know how do i go about making this..


Thanks

Ap
Have you started thinking this through yet? What type of things do you need? What would the basic layout for a program be?
Jul 10 '07 #2
JosAH
11,448 Expert 8TB
Hello every one..

I am planning to make a lexcial analyzer in C++, the keywords, opertators etc for the language that the lexer would take lexmes from are all given to us as a set of requirements.

I wanted to know how do i go about making this..


Thanks

Ap
The magic word is 'regular expressions'; well, ok, that makes two magic words.

kind regards,

Jos
Jul 10 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
Start with a Bachus-Nauer diagram.
Jul 11 '07 #4
TRScheel
638 Expert 512MB
Start with a Bachus-Nauer diagram.
You made me look that up... started with Brachus-Nauer. Got nothing useful. Then went Brachus-Nauer diagram. Found almost nothing. Then tried Brachus Nauer diagram. A little better, though I got hints at Brachus Nauer form. Looked that up, and found this:

Brachus Nauer Form

And I hope that is what you mean.
Jul 11 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
Yep. That's where you start.

All of your lexical rules and tokens will be in the form. Then you design your software
Jul 11 '07 #6
JosAH
11,448 Expert 8TB
Yep. That's where you start.

All of your lexical rules and tokens will be in the form. Then you design your software
Backus-Naur (not "Nauer") form for general grammars would be overkill for simple
linear grammars. Those linear grammars are all that is needed for lexers and
they can be easily expressed by regular expressions.

Backus-Naur form notation for context free grammars comes in handy for the
parser part of compilers etc. (ref: Yacc, Bison, ANTLR etc.).

kind regards,

Jos
Jul 11 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Simon Foster | last post by:
Anyone have any experience or pointers to how to go about creating a parser lexer for assemble in Python. I was thinking of using PLY but wonder whether it's too heavyweight for what I want. ...
1
by: Thorsten Claus | last post by:
Hi, what's the environment variable for in the scite configuration file for the currently used lexer/syntax highlight? I want to have the current markup in the statusbar... Thorsten
6
by: noridotjabi | last post by:
Is there any way in C to write source which would make an executable that excepted modifications. For instance say we have modable program that excepts plugins. That starts with a menu. 1)Add...
6
by: Mike C# | last post by:
Hi all, Can anyone recommend a good and *easy to use* lexer and parser generator? Preferably one that was written specifically for VC++ and not mangled through 20 different platforms. I've had...
0
by: Neil Cerutti | last post by:
I'm a royal n00b to writing translators, but you have to start someplace. In my Python project, I've decided that writing the dispatch code to sit between the Glulx virtual machine and the Glk...
6
by: Java1963 | last post by:
Need help with writting an application that prompt for and read a double value representing a monetary amount. -------------------------------------------------------------------------------- ...
1
by: rahulbsbs | last post by:
Sir how can i get the ip address of the remote system by writting a java code,ie i want to get ip address of the remote system that is connected to my server computer ,the ip address must be...
14
by: Thomas Mlynarczyk | last post by:
Hello, I started to write a lexer in Python -- my first attempt to do something useful with Python (rather than trying out snippets from tutorials). It is not complete yet, but I would like some...
3
by: latif87 | last post by:
An example of how the XML file is structured: <xml> <farm name="NAME1"> <size x="INTEGER1" y="INTEGER2" /> <neighbor name="NAME2" /> <crop name="PLANT" area="INTEGER3" /> <crop /> </farm>...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...

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.