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. C#
  4. C Code Parser

C Code Parser

Scheduled Pinned Locked Moved C#
helpquestion
6 Posts 4 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.
  • D Offline
    D Offline
    Dromar
    wrote on last edited by
    #1

    Hi, I have to wirte a Parser, and therfore I would need all the variables and functions definded in a C file. I realiced there is a class called Codedom, but don't know if it is what I search for. If not do you know any other ways to get variables and functions from a C-file? Thanks for your help. Dromar

    W C 2 Replies Last reply
    0
    • D Dromar

      Hi, I have to wirte a Parser, and therfore I would need all the variables and functions definded in a C file. I realiced there is a class called Codedom, but don't know if it is what I search for. If not do you know any other ways to get variables and functions from a C-file? Thanks for your help. Dromar

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      If you can read the code (for example from a file), compile it and investigate fields, functions etc without actually parsing it yourself, CodeDOM should be useful. If you really want to parse the original yourself, have a look at for example Yacc[^] which can also be found for Windows.

      The need to optimize rises from a bad design

      D 1 Reply Last reply
      0
      • W Wendelius

        If you can read the code (for example from a file), compile it and investigate fields, functions etc without actually parsing it yourself, CodeDOM should be useful. If you really want to parse the original yourself, have a look at for example Yacc[^] which can also be found for Windows.

        The need to optimize rises from a bad design

        D Offline
        D Offline
        Dromar
        wrote on last edited by
        #3

        Just to make clear what I want. I have a Sourcefile (c, cpp, h...) and want to check if the pass certian programming rules (in my case the MISRA-C 2004 rules). Therefore I need all the Variables and Functions. Can I do that with the Codedom? And if yes can you please post me an example?

        W 1 Reply Last reply
        0
        • D Dromar

          Just to make clear what I want. I have a Sourcefile (c, cpp, h...) and want to check if the pass certian programming rules (in my case the MISRA-C 2004 rules). Therefore I need all the Variables and Functions. Can I do that with the Codedom? And if yes can you please post me an example?

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          if the code is .Net based then you can use CodeDom. Several examples for example on MSDN: http://social.msdn.microsoft.com/Search/en-US/?query=codedom%20example&ac=1[^]

          The need to optimize rises from a bad design

          1 Reply Last reply
          0
          • D Dromar

            Hi, I have to wirte a Parser, and therfore I would need all the variables and functions definded in a C file. I realiced there is a class called Codedom, but don't know if it is what I search for. If not do you know any other ways to get variables and functions from a C-file? Thanks for your help. Dromar

            C Offline
            C Offline
            Caio Kinzel Filho
            wrote on last edited by
            #5

            Hi, take a look at Irony .NET. you can find references here in CP. It's well worth to take a look, I think it does what you want.

            Intelligence is almost useless for those who have nothing else! Email: caiokf@gmail.com

            M 1 Reply Last reply
            0
            • C Caio Kinzel Filho

              Hi, take a look at Irony .NET. you can find references here in CP. It's well worth to take a look, I think it does what you want.

              Intelligence is almost useless for those who have nothing else! Email: caiokf@gmail.com

              M Offline
              M Offline
              Mark Churchill
              wrote on last edited by
              #6

              Irony is quite good. As is PerCendburg(?) Grammatica. Used that for quite a few projects where I've had a configuration DSL.

              Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
              Alpha release: Entanglar: Transparant multiplayer framework for .Net games.

              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