Quote:
Originally Posted by wireties
A lexer and parser in LabVIEW? This might get ugly... ;o)
|
I wrote a script interpreter in LabVIEW, it's not ugly at all. It looks very nice, actually.
It reads the text file, splits it into lines, then parses it line by line.
Foreach line, it determines if it is a comment or contains less than 3 characters (and skips it if it does), then splits up the line's text by spaces, taking the first block of text and finding a command with that name, and calling it byref and feeding it the arguments (the rest of the text) as an array of strings. Generally, the functions either take those strings and turn them into doubles, or compare them to constants (to determine an enumerated type).
I spent a little while debugging it on Windows before running it on a robot, and most of my errors were from not initializing shift registers.