antlr - Take input from function parameters, not a file -
All the examples that I have read in a file, Lex & amp; Pars this.
I need a function that takes a string (four *, I am generating the c code) as a parameter, and works on it.
How can I do that best? I thought of writing a string in a stream, then fed it to the laser, but it does not look right. Is there a better way?
Thank you in advance
you antialr3 newsecii string infraxtreme
Method
If you have not used which version of the entry, then I'll consider entrer v3.
This method has the string to parse the input, this is the length and then you can probably use zero for the last input.
This creates an input stream similar to antlr3AsciiFileStreamNew
, which you will use to parse a file.
I see that you mentioned about writing input in any stream. If you can use C ++ then this is the best way you might come.
This is the commonly used BornBox code:
std :: istringstream issInput (std :: CIN); // If you want to parse a file laser allput (issInput), make it an instream; Parser Oppressors (Oliester); OFactory ("CommonASTWithHiddenTokens", & amp; antlr :: CommonASTWithHiddenTokens :: Factory); NTLR :: ASTFceterOffry; OParser.initializeASTFactory (oFactory); OParser.setASTFactory (& amp; oFactory); OParser.main (); Antelr :: refresh ast = oParser.getAST (); If (ath) {trowwoker ottrivkar; OTreeWalker.main (ast, rPCode); }
Comments
Post a Comment