define Keywords in pyparsing for an interpreter
Question: So I know this may be a stupid question and is most likely impossible but is
there a way in pyparsing to create keywords (such as print for python) I am
trying to create a interpreter for a different language in python so that you
can write in this language on android (as python files can be run on python
but the other language can't). For instance in this language there is a PUT
statement that prints out is there a way in pyparsing to "define" this put
statement so that when I import this interpreter I can write PUT "Hello,
World!" instead of (a = 'PUT "Hello, World"', Result = p.parseString(a), print
result[1])


Answer: Rather than write a whole new language, you can add keywords to Python like is
done in this example
(<http://pyparsing.wikispaces.com/file/view/stateMachine2.py/110934709/stateMachine2.py>)
on the pyparsing wiki. The parser picks out your custom keywords, and replaces
them with the expanded Python code that implements that command, then compiles
this code as a regular Python module.

If you want to write a pure DSL, look at the adventure example on that same
wiki examples page, in which I implemented a simple DSL for running an
adventure game using simple commands.

