Flex / parsers for beginners?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tinkertim

    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
  • Chris Dollin

    #2
    Re: Flex / parsers for beginners?

    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

    Comment

    • Tristan Miller

      #3
      Re: Flex / parsers for beginners?

      Greetings.

      In article
      <3925554b-54f7-4663-a54d-cfb0e4d421d0@d7 0g2000hsc.googl egroups.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

      Comment

      • Tinkertim

        #4
        Re: Flex / parsers for beginners?

        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


        Comment

        Working...