By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,160 Members | 1,983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,160 IT Pros & Developers. It's quick & easy.

Flex / parsers for beginners?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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.programmer 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

P: n/a
Greetings.

In article
<39**********************************@d70g2000hsc. googlegroups.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

P: n/a
On Sep 30, 10:04 pm, Tristan Miller <psychon...@nothingisreal.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 discussion thread is closed

Replies have been disabled for this discussion.