This is a preliminary report on scripts of several languages to validate matching brackets.
Little Parser Problem Challenge: Matching Pairs Validation
The problem is to write a script that can check a dir of text files (and all subdirs) and reports if a file has any mismatched matching brackets.
Here's a example of mismatched bracket:
】 etc. (and yes, the brackets may be nested. There are usually text between these chars.)
I hope you'll find this a interesting “challenge”. This is a parsing problem. I haven't studied parsers except some Wikipedia reading, so my solution will probably be naive. I hope to see and learn from your solution too.
i hope you'll participate. Just post solution here. Thanks.
Detailed explanation at Emacs Lisp: Batch Script to Validate Matching Brackets.
Jon Snader (jcs) wrote 2 versions in elisp. See: Xah's Challenge (Part 2) By Jon Snader. @ irreal.org…. Ι haven't studied it yet.
This report is incomplete. So far Raymond Hettinger's python 3 code is the only working code other than elisp. None of the following works on my machine.
For the original post of this problem and the discussion, see: a little parsing challenge ☺ @ groups.google.com….
Thanks to the many who have written code and made helpful comments. I may come back to clean this up, in the coming weeks. If you can correct one of the following programs, please comment.