How to parsing simple scripts

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":

1)
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"
END

2)
IF CAPS "This String MUST Match Capitalization"
THEN ""This string wil be sent via RS232"
END

2)
IF CONTAINS CAPS "This string Is CONTAINED somewhere in the input string, Capitalization match also"
THEN
    IF "a test depending on the previous IF test"
    OR "another string"
    THEN "ok"
    ELSE "No"
    END
ELSE "Another result"
END

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.
Thnkx
fab1970Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marv-inCommented:
here is a link with examples of the various string functions in VB
http://www.officecomputertraining.com/vbtutorial/tutpages/page19.asp

if you would like more specific info let me know
0
fab1970Author Commented:
Marv,
i know the strings functions in vb, what i need is a way to read the examples i've wrote in the question from a text file in a function that, given an input string, do the comparisons.
In other words i need a custom-script interpreter...
Ii's hard to explain in a foreign language, i'm sorry.
0
ArkCommented:
Hi
If you're speaking about 'script', did you thought about 'tags'? You can put smth like 'tags' in the beginning of your strings in a file, like:
[1] First type of string 'optionally end of tag mark [/1], or just [br] or vbCrLf
[2] Second type of string 'optionally end of tag mark [/1], or just [br] or vbCrLf
...etc
Now you can just read a tag and perform action according this tag
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Marv-inCommented:
I think I understand - you want to parse a file that is actually formatted like what you posted. If that is the case this could take some work.

if you want an advanced example of a parsing engine - this is it
http://www.devincook.com/goldparser/engine/index.htm#Engine-DLL

this example includes grammer definitions and lots of other good stuff - plus its free =]
0
fab1970Author Commented:
Marv,
you've right understood me.
I've got a look at the link you tell me. The Gold Engine i'ts a huge stuff for the "little" thing i need... i need some time to understand the Gold Engine.
Anyway, it's a step in the right direction. If you have some simpler example, or some tips for me, you're welcome.

;)
0
Marv-inCommented:
it will be lots of if statements =]

Here is some puseduo code  that should help

while not EOF
 
  readln
 
  if line is IF then
    ParseIF textstream, line
  endif

wend

sub ParseIF (t as textstream, l as string)
  if CAPS IF then
    eval as boolean
  else if IF
    eval as boolean
  endif

  if true then
    readln
    its its another IF
      ParseIF t,l
    else
      write value to output
    endif
  else
    readln till you find ELSE
    its its another IF
      ParseIF t,l
    else
      write value to output
    endif
  endif  

end sub

im sorry i dont have a ton of free time but i would like to help as much as i can
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fab1970Author Commented:
Well, it's a starting point. I now have an idea of what to do. Thanks, Marv.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.