473,320 Members | 1,863 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,320 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 4391
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>...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.