This program attempts to translate source code from Draco to ANSI C. Draco
is a programming language by Chris Gray, the most recent version of which
is Draco 1.2, dated 28/1/89. As development of Draco has ceased, it is
important to be able to convert programs written in that language to C.
This program has been written with that end in mind.
SAS/C source code is included.
Usage is as follows:
1> Draco2C <file> [-a|AMIGATYPES]
For example:
1> Draco2C sieve.d -a
Output goes to CON: by default. You can redirect this if desired:
1> Draco2C sieve.d >sieve.c
The AMIGATYPES argument makes the program use Amiga-style type
definitions such as ULONG, etc., otherwise K&R-style type definitions
such as unsigned int, etc. are used.
It is assumed that the input file is a valid Draco file which conforms
to Draco syntax rules; passing malformed files will most likely cause
the program to hang. In most cases the .c file produced will require
some amount of hand editing before it will compile and run correctly;
however, the program at least does the repetitive gruntwork for you
automatically. It has been tested with a variety of Draco source code.
The following are supported:
(:, :), ($, $), /=, $-, $/, ^, # trigraphs.
and, bool, by, byte, case, char, corp, default, do, downto, elif, else,
esac, false, fi, for, if, ignore, incase, int, long, nil, not, od, or,
proc, short, then, true, type, uint, ulong, upto, ushort, while
signed, unsigned (these may be larger in C than they would be in Draco).
array notation.
in string literals: \e, ''
:=, ~=, *., ><, = operators.
include files.
argument lists.
constants.
The following are unsupported:
, arbptr, boid, code, dim, enum, error, free, make, new, pretend, range.
Operator types.
Pointer arithmetic.
I/O subsystem.
| prefix numeric absolute value operator.
[*] array sizing method.
Range notation (eg. 'a' .. 'z').
Extended while.
: (as used in I/O subsystem).
return codes.
"\(number)", "0bnumber" notation styles.
escaped quotes in strings.
* postfix dereferencing operator.
URL: http://www.users.bigpond.com/james.jacobs/
EMail: james.jacobsbigpond.com
James Jacobs of Amigan Software
30 July 2005
|