[prog] Converting definitions into 'on the fly' code...

Conor Daly conor.daly at oceanfree.net
Wed May 5 15:26:16 EST 2004


On Wed, May 05, 2004 at 10:11:45PM +1000 or so it is rumoured hereabouts, 
Rasjid Wilcox thought:
> 
> I'm still trying to understand exactly what you are after.  I think perhaps 
> you mean:
> 
> "Is there a way of writing a program so that new tests can be easily created 
> with new datasets, without any (real) programming being required?"

Approximately that.
 
> If this is what you mean, then my answer is categorically (particularly given 
> the desire to avoid large amounts of complexity) to use your intepreted 
> language of choice.  My choice (when I have one) is Python.

It may be that this is the way to go.  The question there is how will this
scale in the face of large amounts of data?  Can I write a Python module
for the testing bit and call this from a compiled core program (yes, I
probably can)?  If I need to retrieve more data for a particular test,
will I end up with a module so complex that I might as well write the
whole thing in Python?
 
> If this is what you mean, I can put together a quick sample app in Python, 
> since I've done something very similar already.  Let me know.

Yes please!  I've been poking around with a C example based around a
parsing tree as detailed in my first post but I'd love to see a few "how
you do it in other languages" examples...

Spec:

Given this string:

"a < mean ( b[1] : b[10] ) / 2"

1. Analyse the tokens 'a', 'b[]' and locate the data
2. Analyse the expression
3. Conduct the specified operation on the data
4. Return a result

I can (relatively) easily manage step 1 given a defined set of variable
names (there already exist a set of 'code letters' describing weather
parameters) and work out how to retrieve the data. [0]

Doing step 2 and transforming it into step 3 is the hard bit.

Helpfully though, it's not envisaged that any data will be _changed_.
Instead, flags will be raised so that a human operator can analyse (and
hopefully fix) the data.

Thanks,

Conor

[0] I'm giving the database designer heart attacks suggesting there should
    be a table that is an index to the tables.  eg. 

Stno | parameter | description | start_date |   end_date | table   | column
-----+-----------+-------------+------------+------------+---------+-------
373  |    td     |   drybulb   | 1993-04-03 | 1995-12-31 | hours   | td
373  |    td     |   drybulb   | 1996-01-01 |            | minutes | td1
373  |    td     |   drybulb   | 1996-01-01 |            | minutes | td2
376  |    td     |   drybulb   | 1941-01-01 |            | days    | dblb
-----+-----------+-------------+------------+------------+---------+-------

"What!  You want to include a table in your data model?!!"
-- 
Conor Daly <conor.daly at oceanfree.net>

Domestic Sysadmin :-)
---------------------
Faenor.cod.ie
  3:15pm  up 195 days,  7:24,  0 users,  load average: 0.00, 0.00, 0.00
Hobbiton.cod.ie
  3:04pm  up 43 days, 18:32,  1 user,  load average: 0.03, 0.03, 0.00


More information about the Programming mailing list