TDL Version 0.9 Development Notes

TDL 0.9 requires python 2.6(!!!) and numpy 1.2.1 or higher.

This version of tdl relies on the ast module from python 2.6 for code parsing and interpretation. This module exposes Python's own abstract syntax tree, which is an intermediate representation of the code as it is interpreted. From an implementation view, using this module means:

Version 0.9.0 of this code can be found in the svn repo or here: tdl_0.9.0.tar.gz

The basic usage hasn't changed much, and several important bits work:

  1. basic variables and math
  2. array slicing, sub-indexing, object attributes, methods
  3. control flow: if/else/elseif, while, for. try/except is broken, see below
  4. tdl procedures (equivalent to functions)
  5. defined variables
  6. import, from-import work, importing either tdl or python modules(!)

But there are many things left to be done:

  1. error/exception handling (I'd call it "implemented badly, but I know how to fix it").
  2. built in help system.
  3. move existing modules (mostly Tom's) to new version
  4. guis
  5. scipy issue: Since tdl requires python2.6, but scipy is not yet available on Windows for python2.6. I assume this will get fixed eventually, but that creates a problem for some existing modules, and for Ifeffit2.

A simple sample session:

tdl> x = 1
tdl> y = sqrt(10)
tdl> g = group(x = 5, str = 'hello', arr = arange(10)/3)
tdl> g
<Group: 3 items, id=0x2aaab0fb3190>
tdl> show_group(g)
== <Group: 3 items, id=0x2aaab0fb3190> ==
  arr: array([ 0.        ,  0.33333333,  0.66666667,  1.        ,  1.33333333,
        1.66666667,  2.        ,  2.33333333,  2.66666667,  3.        ])
  str: 'hello'
  x: 5
tdl> while y < 100:
...>    y = y * g.x
...>    print y
...> #endwhile
15.8113883008
79.0569415042
395.284707521

Syntax differences between TDL and Python

1. tdl does not use indentation level. Rather a block

2. a Defined Variable can be defined with

3. command syntax is allowed in some cases, so that parentheses


tdl/Version0.9 (last edited 2009-10-09 19:46:45 by localhost)