473,545 Members | 289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Flex / parsers for beginners?

Hello to all,

I've been using C for a long time however I'm about to take my first
splash into making a parser. I have some interesting things to
accomplish and I'm hoping to get some recommended links to tutorials
that might help me jump in.

I will be parsing a configuration file, like this:

vars {
shemp = "not_larry"
lucy = "in the sky with diamonds"
}

group foo {
class bar {
foobar = %lucy%
barfoo = *.txt
}
default = foo
stooge = %shemp% ? %shemp% : "none"
}

There's some interesting stuff going on there, I will need to expand
variables, handle globs and handle stanzas inside stanzas inside
stanzas.

Globbing really doesn't have much to do with the parser, just there as
an example of what I need to accomplish.

I've spent the last few days reading many tutorials on flex, however
many of them assume that I know a little more than I do.

Could some kind soul point to some links that might help me wrap my
head around it?

Thanks in advance!
--Tim
Sep 30 '08 #1
3 3328
Tinkertim wrote:
Hello to all,

I've been using C for a long time however I'm about to take my first
splash into making a parser. I have some interesting things to
accomplish and I'm hoping to get some recommended links to tutorials
that might help me jump in.

I will be parsing a configuration file, like this:
(fx:snip)
I've spent the last few days reading many tutorials on flex, however
many of them assume that I know a little more than I do.
flex is not sufficient to your task; it does tokenisation, and you'll
need more general parsing such as is provided by yacc/bison/et al.

comp.unix.progr ammer would be useful for flex/bison advice, and
perhaps more so (but less C-oriented & more theoretical if needed)
would comp.compilers (it doesn't restrict itself to just "compilers" ).

flex/bison aren't as such on topic here -- but all sorts of issues
raised using them /are/.

--
'It changed the future .. and it changed us.' /Babylon 5/

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

Sep 30 '08 #2
Greetings.

In article
<39************ *************** *******@d70g200 0hsc.googlegrou ps.com>,
Tinkertim wrote:
I've spent the last few days reading many tutorials on flex, however
many of them assume that I know a little more than I do.

Could some kind soul point to some links that might help me wrap my
head around it?
[OT] I found the O'Reilly book "lex & yacc" to be an absolutely excellent
guide to lex and yacc, in all their incarnations. It's both a tutorial
and a reference guide. I highly recommend you obtain it and read it
thoroughly. If you can't find or afford it, however, the texinfo pages
for flex and bison are pretty good. [/OT]

Regards,
Tristan

--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= < In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
Sep 30 '08 #3
On Sep 30, 10:04 pm, Tristan Miller <psychon...@not hingisreal.com>
wrote:
[OT] I found the O'Reilly book "lex & yacc" to be an absolutely excellent
guide to lex and yacc, in all their incarnations. It's both a tutorial
and a reference guide. I highly recommend you obtain it and read it
thoroughly. If you can't find or afford it, however, the texinfo pages
for flex and bison are pretty good. [/OT]

Regards,
Tristan
Thanks Tristan, I'll pick up the book. Sorry to go off topic :)

Cheers,
--Tim
Oct 1 '08 #4

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

Similar topics

4
3600
by: Peter Kleiweg | last post by:
Hi, I am looking for a Python equivalent of Flex. After some browsing, it seems that Plex is my best bet, but I would like to hear suggestions before I dive in. I have been using Flex a lot in combination with C programming. I never use Yacc (or Bison), though Flex and Yacc are supposed to be used together. But I found Yacc too...
4
7126
by: Jerry Sievers | last post by:
Dear Pythonists; Curious if there exists in Python package(s) for use as lexer/parser for implementation of language grammars? Already using cmd.py from the standard distro for it's basic features but wishing for much more advanced capability. As such, I refer to flex/bison because though complex they are general purpose and very useful.
2
6571
by: olig9 | last post by:
Hello, is there a way to feed an ifstream to a parser generated with flex and bison? I could see that flex wants a FILE* for reading, but I only have an ifstream (actually and ifstream*) for input. It seems that flex++ can use an ifstream; but how does the generated lexer then work with bison? Or is there a (portable) way to get a FILE*...
6
15460
by: Volker Hetzer | last post by:
Hi! We are finding ourselves in a situation where we have to parse several more or less free format text files. In the past, on linux, we had flex and bison for generating very fast parsers for these files. Is there any equivalent in the visual studio world? Lots of Greetings! Volker --
2
3729
by: dwelch91 | last post by:
Hi, c.l.p.'ers- I am having a problem with the import of xml.parsers.expat that has gotten me completely stumped. I have two programs, one a PyQt program and one a command line (text) program that both eventually call the same code that imports xml.parsers.expat. Both give me different results... The code that gets called is (print...
5
5935
by: ASP.NET explorer | last post by:
I have been asked to create some simple animation using Adobe Flash player in ASP.NET(C#) web application. While I am fairly well versed with ASP.NET C#, I absolutely have NO IDEA about how to say "Hello World" in a Flash enabled web page rendered via ASP.NET. Can any one let me get started? ---
10
6694
by: Jules Winfield | last post by:
Guys, I've been designing applications for the financial services industry using MSFT technologies for many years (Win32 API, MFC, and now .NET WinForms). All applications are Internet-based, with a "thick client" which makes calls to my grid of servers via a socket or remoting connection. Customers are pleased with my work but it seems...
3
3525
by: Tarik Monem | last post by:
Hi Everyone, Still a newbie with FLEX, and I've passed arrays using AJAX to FLEX before, but I've never passed links to FLEX. Basically, this is the OUTPUT, which I wanted, but I'm given an error of "illegal character," from the JavaScript console: Error: illegal character Source Code:
2
4004
by: Wolfgang Draxinger | last post by:
I'm currently working on a laguange similair in concept to Vala (google for it on the Gnome project site). A (very) high level language is translated into intermediary C, which is then compiled to target. I want to be able to "include" C headers, so that I don't have to write bindings. That however means, that I have to parse them. I could...
0
7398
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
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
7805
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
7416
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
5969
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...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3449
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...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
701
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.