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. Algorithms
  4. comipler construction

comipler construction

Scheduled Pinned Locked Moved Algorithms
questionregex
6 Posts 6 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.
  • R Offline
    R Offline
    rizwana rashid
    wrote on last edited by
    #1

    what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????

    C M L P 4 Replies Last reply
    0
    • R rizwana rashid

      what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You need to search for anything except a closing comment, including newlines. Expresso is a great tool for testing and building regex.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • R rizwana rashid

        what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????

        M Offline
        M Offline
        mabo42
        wrote on last edited by
        #3

        You should have a look at this step by step article for developing a multiline comment regex: http://ostermiller.org/findcomment.html[^]

        1 Reply Last reply
        0
        • R rizwana rashid

          what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          it is also conceivable to create a compiler without using any regex. :)

          Luc Pattyn


          Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


          M 1 Reply Last reply
          0
          • L Luc Pattyn

            it is also conceivable to create a compiler without using any regex. :)

            Luc Pattyn


            Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


            M Offline
            M Offline
            molesworth
            wrote on last edited by
            #5

            Just what I was going to say. Regexes are probably the least useful tool for writing a compiler. OK, a spanner is probably less useful, but you know what I mean :)

            There are three kinds of people in the world - those who can count and those who can't...

            1 Reply Last reply
            0
            • R rizwana rashid

              what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              You need to remember to escape the asterisks. /\*.*?\*/ It doesn't handle nested comments, but I understand that balancing groups could be used to cover that. One of the problems with trying to do it with a RegEx is that you have to read the entire file into a string before you process it and then use the SingleLine option.

              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