Posted on 1998-10-15
I have a test script syntax of the form:
1. READ TRACK_1 & (TRACK_2 | TRACK_3)
2. WRITE TRACK_1 | TRACK_2
The first implies that tracks 1 is required AND either if tracks 2 or 3. The second implies that either track 1 or 2 is OK. These are left associative. READ, WRITE, TRACK_1, TRACK_2, TRACK_3 are the only keywords.
I have to find a general (but efficient) algorithm to do these. I also want to be able to store the order of evaluation to a structure that I can pass to any routine (that way, I don't have to parse again). I already have a tokenizing routine so that's one out.
Any ideas? (This is usually directed to anyone with an experience in compilers and translators).