From: Stefan Behnel on 11 Apr 2010 10:24 Stef Mientki, 10.04.2010 18:08: > I would like to translate some functional description into some standard > class object, > so it can be used as a basic building brick into a larger piece of code. > > Suppose the functional description is: > > Name = 'Test_Function' > Out = 3 * In Ok, so you want to implement a domain specific language (DSL) for function post conditions. First thing to ask: how expressive do you want this language to be? If the answer is "as expressive as the code it describes", then you will end up needing a turing-complete programming language, in which case you may want to use plain Python code instead of writing your own language. See the doctest module. Implementing a language that can express "x*3" is relatively(!) easy, but I would guess that you want your post conditions to be a little more expressive than that. Could you describe why you want such a language in the first place? What feature do you need that cannot be expressed using doctests, for example? Stefan
|
Pages: 1 Prev: universal newlines and utf-16 Next: Twisted and txJSON-RPC |