[RFC] How to implement command line tool integrating parsing engine

Diez B. Roggisch deets at nospam.web.de
Sat Mar 22 10:07:22 EDT 2008


llandre schrieb:
> Hi all,
> 
> I'd like to have some advices about how to implement a program that has 
> the following requirements:
> - it must run both on linux and windows PC
> - it must interact with an electronic device connected to the PC through 
> serial cable by sending/receiving some command strings and taking 
> different actions depending on device responses; these strings and 
> actions must be described in a text file (a sort of script) editable by 
> user with a simple text editor; the language used to described this 
> algorithm should be as simple as possible
> - initially the program must be written in the form of simple command 
> line tool that is invoked like this:
>     program <script_file.txt>
> - in the future, it must be possible to develop a graphical frontend on 
> top of it; the resulting look&feel should be similar on linux and windows.
> 
> In this mailing list I was adviced to use python:
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/37939
> 
> As I never used python, I ask you:
> 1) about the script file, which language - for which a parsing engine is 
> already available in python - do you suggest?

Don't use a home-made-language. Use python itself, together with a lib 
of pre-defined functions and hooks.

Python can do the serial communication (google pyserial), and together 
with e.g. the execfile-command you can execute the user-provided 
commands after initializing your system.

> 2) about the graphical frontend, which graphical libraries do you 
> recommend?

Google this group for a PLETHORA of discussions about this very subject. 
The answer vary depending on usecase, taste & relative moon humidity.

Diez



More information about the Python-list mailing list