Your script is my command!
December 22, 2009 1:09 PM Subscribe
[Software Development filter] I am working on a project that uses a PC (Windows) and a dedicated microprocessor to perform a specific task. I want to create a scripting language that will allow the user to write their own sequences for the tool.
posted by Drasher to computers & internet (27 answers total) 2 users marked this as a favorite
The front-end of the software is being created using MS Visual Basic (Visual Studio) 2008. There is a "processing" back-end being created with the same development package, but using C++ to create a DLL. The DLL uses USB to communicate with a PIC (PIC24FJ256GB110) microprocessor that will control elements of the tool (heater, flow controllers, valves, solenoids, and relays) and gather data from other elements (pressure sensors, temperature sensors, liquid sensors, gas chromatograph).
I want the end user to have the ability to write a script and have the tool process the commands.
The script will have a simple language and limited number of commands.
10 DELAY XXX ms/sec/min
20 TURN ON PUMP_1
30 TURN OFF VALVE_3
40 FLOW_CONTROLLER PURGE
50 FLOW_CONTROLLER 100 ml/min
60 IF PRESSURE_SENSOR_1 > 100 THEN GOTO [line number]
and so on...
I have searched for and found a couple of "tiny basic" interpreters written in C that look like they could be modified and wedged into service. These interpreters use integers only, I might need floating point capability (pressure value comparisons, etc.) One interpreter requires line numbers the other uses labels for GOTOs and GOSUBs. I don't know if I should use line numbers (requires renumbering at some point) or labels (preprocess a symbol table).
I have a feeling that the end users are not very computer savvy so the scripting would have to be easy to understand and provide adequate error messages.
Do you (or someone you know) have an idea of a better path?
Should I try lex & yacc?
Should I just suck it up and try starting an interpreter from scratch?
Any and all replies are welcome.
AskMe has pulled me out from a jam before, PLEASE do it again!