How would you write a parser/lexer for AppleScript?
-
Is it feasible to write on using YACC, and ANTLR?
-
Answer:
I don't know a lot about AppleScript, but unless it is seriously weird, I can't imagine you can't write a reasonable parser using conventional parser-generator tools (along with the usual troubles that typical parser generators bring by imposing their limitations (LALR(1), LL(1)) on the grammar you might write). People manage to build parsers with these tools in spite of the glitches. What I can tell you from almost 15 years of experience with a GLR parser generator, is that building parsers even for langauges considered "hard" is relatively straightforward with GLR. Our DMS Software Reengineering Toolkit has a GLR parser generator, and we parse some 40 languages with it, including C++11 with all the complications of GCC and MS Visual Studio variants without the usual trouble that people building C++ parsers have. Based on that, I'd expect AppleScript to be relatively easy.
Ira Baxter at Quora Visit the source
Other answers
It's certainly feasible. In fact, YACC was the parser tool used for the earliest versions of AppleScript. Read Bill Cook's fascinating account of early AppleScript development history here: http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf As for how I'd go about it, I honestly haven't given much thought, since it's not exactly one of my favorite languages.
Adrian Ho
Related Q & A:
- How do I write a good peer review?Best solution by Quora
- How do I write a search page?Best solution by Stack Overflow
- How do you make a password in an Applescript?Best solution by Stack Overflow
- How does one create a recursive lexer?Best solution by stackoverflow.com
- How do I write a resume for a part-time job?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.