comipler construction
-
what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????
-
what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????
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.
-
what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????
-
what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????
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.
-
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.
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...
-
what is the regular expression of muliple line commment other then /* (a+n)* */ bcoz this expression donot accept /* hhhhhhhh*hhhhh*/ string ???????
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.