I need help with translation

jmcclain@tcshealthcare.com (jmcclain)
28 Nov 2004 23:22:55 -0500

          From comp.compilers

Related articles
I need help with translation jmcclain@tcshealthcare.com (2004-11-28)
| List of all articles for this month |

From: jmcclain@tcshealthcare.com (jmcclain)
Newsgroups: comp.compilers
Date: 28 Nov 2004 23:22:55 -0500
Organization: http://groups.google.com
Keywords: translator,question
Posted-Date: 28 Nov 2004 23:22:55 EST

Here is my problem:
I have list of ~150 powerbuilder functions that I need to translate
into their associated Java function calls.
I do not need to translate the entire powerscript language, I am only
translating powerscript expression.
Here is an example of a typical expression that would need to be

left(gf_RetrieveValue( 'patient', 'phone',
'patient_identity='+string(gf_GetPatientIdentity( )), 'No Phone Number
on File' ),3)+'-'+mid(gf_RetrieveValue( 'patient', 'phone',
'patient_identity='+string(gf_GetPatientIdentity( )), 'No Phone Number
on File' ), 0, 100)

the function prototypes would be:

left(String s, int n) => return a string of the leftmost 3 chars
gf_RetrieveValue(String table, String column, String whereClause,
String default) => returns a string from a table/field/whereclause in
a DB
string(int n)=> converts into to string
gf_GetPatientIdentity( )=> Returns an int. This would be the patientID
in the current context
mid(String s, int start, int length)=>returns subtring of s starting
from start and ending at length

Some of these functions do not have associated standard java function
calls (e.g., gf_RetrieveValue), so I would have to write them.

All function parameters can themselves be string or numeric

I do not wish to compute the values of the expressions, as they could
be dependent on data that would not be available in the running
context. I only wish to generate the associated java specific
translation. This translation along with a condition under which to
execute the code will be put into a format that will be sent to a
rules engine (http://www.drools.org/) for processing.

Is there any easy way to do this???

Is there an example/tutorial out there of something similar to this?

What would be a good way to approach this problem?

I have ~ 1.5 months to get this done, and it's been a long time since
class 141, compiler construction!

John McClain
Senior Software Engineer
TCS Healthcare
"Before you criticize someone, walk a mile in their shoes.
That way, you'll be a mile from them, and you'll have their shoes."

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.