I recently planned to redo a previously unfortunate job. One of the small tasks was to write a simple SQL syntax analyzer.
My undergraduate course "compilation principles" rarely leaves some images in my mind. In the original course, I wrote a compiler called dicuf (which seems to sound like this). Under the spur of an evil Ta, we used Lex and YACC to successfully escape from the terror. Now we have to pick up compilation again, which is still somewhat challenging.
It is a good thing. On the Internet, I went around and learned about some of the grammar analyzer's automatic generation tools. It is summarized as follows for reference.
It was born in UNIX and is the most classic lexical/syntax analyzer. Currently, it also supports the generation (installation environment) on Windows. However, the language of the generated syntax analyzer is only C language.
Similar to the former, Bison and YACC have high compatibility. The generation languages are C, C ++, and Java.
An earlier syntax analyzer generation tool. The syntax analyzer has many languages, including C #, Java, C ++, F #, VB. NET, and Oberon.
As part of a translation program, you can use simple operators and actions to parameterize Your syntax, so that you can tell anlr how to create an abstract syntax tree (AST) and how to generate output. Anlr knows how to generate recognition programs. The language used to generate the syntax analyzer includes Java, C ++, and C #. syntax.
It is a complex analyzer with the most Supported languages. The generation languages include Assembly-intel X86, ansi c, C #, D, Delphi, Java, Pascal, Python, Visual Basic, and Visual Basic. net, Visual C ++, all.. NET language and all ActiveX languages. It is hard to imagine that this is a free software.
This is a C # and Java syntax Parser Generator (parser generator or compiler called compiler complier ). Compared with other similar tools such as YACC and anlr, it provides better improvements. This is because grammatica:
1. created better comments and readable source code.
2. Automatic Error Recovery and detailed error information are available.
3. Supports syntax/Lexical testing and debugging.
It is one of the most popular syntax analysis generators developed in Java. It also provides tools such as jtree to help us build a syntax tree. It also has an Eclipse plug-in used to assist javacc application development. The syntax analyzer language generated is Java.
There are also many syntax analyzer generation tools, such as jflex, sablec, beaver, jtopas, runcc, cup, sjpt, and chapeon. But I did not have the energy to introduce them one by one. I did not expect this tool to be so numerous.
Finally, I chose grammatica because I need a C # syntax analyzer and the requirements are simple enough :)
I used an example of grammatica to generate a C # syntax analyzer and port it to the Silverlight Project (as required by another project), which is currently running well. Because. NET is very similar to Silverlight. net, this porting job is easier than imagined. However, I do not agree to put the syntax analyzer on the web, which will significantly increase the client. One way to consider is to encapsulate the syntax analyzer used to verify the function into a web service and put it on the server.