AST is an "abstract syntax tree", and you don't need AT commands.
In fact, ANTLR is redundant for parsing AT commands. Why not just check "AT" and then parse the commands manually? The modem command set is probably simple enough that it will be easier to do this than get ANTLR if you have never done it before.
If you implement the full set of AT commands, including the escape sequence β+++β, time is also a factor that you cannot implement using only ANTLR.
Reply to comments:
Seeing ANTLR as a tool to reduce errors is prudent. Answering your questions: βWould you rather read this code or the code that would be processed? And what would you rather save?β, The answer is βit depends.β I use ANTLR and manual encoders depending on the context; this is the context in which I would choose a parser with manual coding. Some reasons: perhaps a built-in application, relatively simple (many teams are not equal in complexity), a communication protocol. You have a different context, and you have your own reasons, which include trying.
So, to answer your other question about the main thing: yes, you can use the one on the ANTLR wiki. To read from a piece of memory, use antlr3NewAsciiStringInPlaceStream() or antlr3NewAsciiStringCopyStream() (if necessary) instead of antlr3AsciiFileStreamNew() .
source share