[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting EL to something proper



PureBytes Links

Trading Reference Links

"Robin B. Lake" wrote:

> Someone asked in a posting to Mark Brown:
> 
> "and how would one convert an EL coded system to work with Traderware
> language?  Would you provide a conversion facility?"

> Here's the line of reasoning:
> EL is either compiled or interpreted.  If it is compiled, there is,
> deep in the heart of EL, a "parser" that creates data structures from
> EL commands.  Parsers are not hard to build, given a proper
> and complete description of the EL language.  From the output of
> that parser, it is rather straightforward (junior level computer science)
> to build a code-generator to produce your favorite language's code ...
> VB seems to be called for here.

<snip, snip>

I agree, not too hard for a CS student or young starving assistant
professor.  There are at least two ways to look at the question of
"conversion" in this instance.  

First, some long time TS users with a lot of EL code will (initially
or perhaps permanently) just want their existing code to work with
Traderware, TradeLab, or other new programs which have an ability to
call DLL's, or to use a COM or ActiveX interface to user's add-ins.
For this situation, an EL compiler is needed.  For this you need a 
definition of the grammar of the EL language.  But since EL is 
similar to Pascal, this should not be difficult to create by modifying
a definition of Pascal grammar.  With this in hand and the tools lex
and yacc (lexical-analyzer and yet-another-compiler-compiler), one
generates an EL compiler.  There are good examples to start from, 
again because of the similarity of EL and Pascal.  For example, there
are complete free pascal compilers (with source): GNU pascal, FPC,
p4, and others.  

The second obvious route to "EL conversion" is an actual conversion
from EL to another language which can be compiled with a commercial 
compiler, such as VB, C, or Delphi.  There is a freeware pascal to 
c converter, known as p2c.  It might suffice to convert a lot of the
body of EL routines to c, or maybe it could be modified to convert
all of EL to c.  With tools like this, the calculations tend to 
convert well, but output either does not convert or turns into ugly
but functional code in the output language.  However, I suspect 
most EL routines which users would like to convert simply does some
calculation and returns results for presentation by TS with little
direct output.

Nothing is ever as easy as the theory sounds, but there are certainly
building blocks to start from in this case.

Rod