LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

sccipt interpretor

All, I am looking to create a script intpretor in cvi to enable our engineers to put together test scripts easily, commands would along the lines of connect x to y, measure log etc... nothing to complecated. I know in C it can be done simply using pointers but forgotten how. basically the command interpretor would load a test file then execute it. If someone could jog my memory that would be great. many thanks in advance
Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 1 of 2
(3,046 Views)
this is a simple problem if you do it right from the start.

first step: define your language. use a standard notation like BNF to specify precisely the grammar which will be used to write the scripts. eventually, annotate your grammar with semantic elements which will specify things that can't be expressed in BNF.
second step: write a parser. the parser will read the script and translate it to what is called an AST (abstract syntax tree). each element read will fit into a structure, and the whole structure will be a computerized representation of the script. (the AST is not strictly necessary, but will allow you to add loops, jumps or functions easily if needed afterward)
third step: interpret the AST. the easiest part.

a very precise and concise guide is "Compiler construction" written by N. Wirth, kindly available online. you only need to read up to chapter 9.
other readings available here (but most of them are very advanced).

please note that the first step is the most important ! a clear, concise and very precise grammar will help a lot for the rest of the project.
0 Kudos
Message 2 of 2
(3,009 Views)