Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Using Context Free Grammers

Using Context Free Grammers

Scheduled Pinned Locked Moved ATL / WTL / STL
json
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fordge
    wrote on last edited by
    #1

    Suppose I want an application which takes a source file and outputs its data members and functions. Supposed to develop into a kind of class view explorer. Regarding parsing the source file .... should i go for using regular expressions rules for this parsing or should i go for a language representation in context free grammer[CFG] and use the CFG rules for parsing or is there any other possible ideas for source file parsing awaiting advice fordge

    S J 2 Replies Last reply
    0
    • F fordge

      Suppose I want an application which takes a source file and outputs its data members and functions. Supposed to develop into a kind of class view explorer. Regarding parsing the source file .... should i go for using regular expressions rules for this parsing or should i go for a language representation in context free grammer[CFG] and use the CFG rules for parsing or is there any other possible ideas for source file parsing awaiting advice fordge

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      CFG. You could use Lex/Flex and Yacc/Bison ( X|) or something like Antlr[^] ( :cool: ). The Antlr site has several free for use grammars for different languages. Stuart Dootson 'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'

      1 Reply Last reply
      0
      • F fordge

        Suppose I want an application which takes a source file and outputs its data members and functions. Supposed to develop into a kind of class view explorer. Regarding parsing the source file .... should i go for using regular expressions rules for this parsing or should i go for a language representation in context free grammer[CFG] and use the CFG rules for parsing or is there any other possible ideas for source file parsing awaiting advice fordge

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #3

        C++ code is hard to parse, unless you have an LL(k)-parser, IIRC. I believe ANTLR is a generalized LL(k) parser generator. But I'm unsure if there are any freely available LL(k) grammars for ISO/IEC 14882 C++. Many class viewers do heuristic parsing, which are basically "creatively guessing" parsers. I don't think they are strict CFG parsers. Good music: In my rosary[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups