I am interested in parsing regexes (not to be confused with using regexes for parsing). Is there a BNF for Java 1.6 regexes (or other languages?)
[NOTE: There is a similar older question which did not lead to an answer for Java.]
EDIT To explain why I need to do this. We are implementing a shallow parser for Natural language processing which first identifies and tags tokens. These are then further processed with a regex. I need to know what groups have been captured by the regex (the automaton only captures the last of each bracket) and I also want to annotate the regex with comments.
Here they point to attempts at describing Perl's regexes in BNF:
http://www.cs.sfu.ca/~cameron/Teaching/384/99-3/regexp-plg.html
http://www.faqts.com/knowledge_base/view.phtml/aid/25718/fid/200
I don't see one specifically for java 1.6; but here's a start that maybe you can build a complete BNF from:
http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/wd/regexp.html#RegularExpressionBNF
...using the java 1.6 documentation for Pattern:
http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With