How to parsing simple scripts
Posted on 2004-10-30
I need to build a "simple" script parser: an app receive strings from a RS232 connection.
In a text file i have some "expressions" to execute, the app reads these expressions and return via RS232 the correct answer.
I put here a starting idea of what i think about these "expressions":
IF "the input string must match exactly this string, no care of capitalization"
THEN "This string wil be sent via RS232"
ELSE "This is another string that wil be sent via RS232"
IF CAPS "This String MUST Match Capitalization"
THEN ""This string wil be sent via RS232"
IF CONTAINS CAPS "This string Is CONTAINED somewhere in the input string, Capitalization match also"
IF "a test depending on the previous IF test"
OR "another string"
ELSE "Another result"
Well, i hope you can uderstand what i mean.
I'm searching for a sample, a link, something that make me able to build the "expression" parser, converting the lines readed from the text file in a functon that works.