[comp.sys.amiga] Draco

disd@hubcap.UUCP (Gary R. Heffelfinger) (01/29/88)

I have just discovered DRACO, the curious language written by a
professional compiler writer in his off hours.  (Forgive me, but his
name escapes me.)  Are there any experienced DRACO users (Draconians?)
on the net?  Does the compiler's author have access to it?  I've been
writing some programs in it over the last few evenings and I admit that
I like its feel.  Consider, though, that I've been spending far too much
time spinning my wheels with TDI Modula-2, so just about any working
compiler that doesn't steal my precious memory would be refreshing. :-)

The author has provided resonably good documentation and lots of code
samples to read, so I'm not really looking for that kind of information.
What I'd really like to know is, are there any vicious bugs I should be
aware of?  The simple Intuition programs I've attempted have worked like
a charm, but I haven't gone very deep and I certainly haven't written
any long code.  I'd also like to get a feel for whether or not the
author is still working with it.  In his docs he mentioned that he was
working on a Amiga version of his DRACO linker. I believe he also
mentioned some REAL variable support.  (Don't really need it much but
it's nice to have it when I do need it.)  The bottom line is that it
impresses me enough that I'd be willing to send the author some $$'s for
his work, assuming that he hasn't completely abandoned work on it.


-- 
Gary R. Heffelfinger                  Employed by, but not the 
disd@hubcap.clemson.edu               mouthpiece of, Clemson University
"If you prick me, do I not...leek?"  -  Data     

cg@myrias.UUCP (Chris Gray) (02/03/88)

Draco is still alive and well. There are a few users around town here (Edmonton
Alberta - the frozen north), plus scattered others down in the US of A. There
could also be lots more that I don't know about. As for its current status
with me:

    - I use it for all of my programming on the Amiga
    - since the Draco distribution (Fish disks 76 and 77), I've been busy
       working on:
          - Amiga Empire (a full rewrite of UNIX Empire) - Fish disk 118?
	  - a Canadian content screen hack (coming soon!)
	  - IFF stuff (showILBM with colour cycling)
	  - a truly overkill expansion of my terrain generator, including
	     a colour palette editor requester, a file requester, and a
	     library to ease text menu creation
	  - the Amiga port of my graphics D & D game system. This involved
	     about 4K lines of new code (View, moving Viewports, input.device
	     handler, mouse handling, a sprite, etc. along with a whole new
	     polygon-fill picture editor (to be scrapped, sigh))
	  - small start (the lexical analyzer) for Draco-II (don't hold
	     your breath!)

As for bugs, well there are some that have shown up, but none have been
serious enough to merit a redistribution. Here's the complete list as far
as I know (if anybody knows of any others, PLEASE let me know!):

   - the result of an I/O operation (like read, writeln, etc.) returns a value
     (internally called an IORESULT) which is boolean if used, but can be
     ignored without a message from the compiler. Currently you can't use
     one of these as the return value of a procedure. (Probably a 5 line fix.)

   - Can't currently predeclare a function with a parameter which is an
     array of unknown size. E.g. the compiler won't accept

	extern func([*] int param)int;
	...
	proc func([*] int param)int:
	    ...
	corp;

   - bad code is generated for a construct like this:

	if (x = 'a') ~= (y = 'a') then
	    ...

     I probably forgot to call "putInReg" for the left-hand-side expression
     for a comparison of booleans.

   - include/devices/timer.g     change UINT -> UNIT
     include/exec/interrupts.g   parameter of "Cause" in "*Interrupt_t"
     include/exec/interrupts.g   is_data -> is_Data
     include/intuition/gadget.g  added union types instead of *byte
     a few other minor changes to obscure include files

   - the compiler uses a shift right to do a signed integer divide by a
     constant power of 2. This doesn't work. Oops!

The last two are the only ones I've bothered to fix.
-- 
Chris Gray		Myrias Research, Edmonton	+1 403 428 1616
	{uunet!mnetor,ubc-vision,watmath,vax135}!alberta!myrias!cg

martens@CIS.OHIO-STATE.EDU (Jeff Martens) (12/02/89)

In article <0847.AA0847@ami-cg> Chris Gray (mail to whom bounces) writes:

>The answer of course is that you shouldn't BUY any compiler; you should just
>trot on down to your nearest Amiga user's group (or decent software store) and
>pick up copies of Fish Disks #76, 77 and 201. (Should be available for the
>cost of the disks + copying.) They will provide you with a full distribution
>of my Draco compiler/system for the Amiga. Code compiled with the compiler on
>Fish #201 will execute almost as fast (with 10% in most cases, I'd say) as
>that generated by any of the commercial compilers. The language also provides
>strong type checking, which can be an immense boon to someone just starting
>out with Amiga programming, something which C and Fortran don't do. All of
>the languages (except, likely, Fortran) provide essentially the same features,
>so graphics programming will be much the same in any of them. I've done a
>number of graphics programs in Draco, and I've seen others done by happy
>users elsewhere.

>Given the price, (free), its a good way to find out if your really do want
>to get into this Amiga programing stuff!

>P.S. There will be a third version of the compiler coming out in the future,
>as soon as I finish with Amiga Empire V2.0 . So far I've added global register
>variables (real useful for shared libraries) and data initializations like
>those in C.

>Chris Gray    usenet: {uunet,alberta}!myrias!ami-cg!cg	  CIS: 74007,1165

It seems that I've heard of Draco somewhere along the way, but really
know nothing about it.  So, for people in my situation -- ignorant of
Draco, spiteful of C, and too cheap to buy a Modula-2 compiler --
maybe you could post a quick description of Draco.  

Also, you suggested that we pick up 3 Fish disks.  Am I correct in
guessing that really FF201 is enough?  Or would I really want all
three?  Thanks.

Does Draco per chance run on a Sun 3 Berkeley Unix system?  In the
best of possible worlds, I'd just be using one language.

-- Jeff (martens@cis.ohio-state.edu)

With the 11/89 issue, the Communications of the ACM has finally become
100% devoid of computer science.

cg@ami-cg.UUCP (Chris Gray) (12/08/89)

In <8912020143.AA10404@dinghy.cis.ohio-state.edu>
	martens@tut.cis.ohio-state.edu writes:
>It seems that I've heard of Draco somewhere along the way, but really
>know nothing about it.  So, for people in my situation -- ignorant of
>Draco, spiteful of C, and too cheap to buy a Modula-2 compiler --
>maybe you could post a quick description of Draco.
>
>Also, you suggested that we pick up 3 Fish disks.  Am I correct in
>guessing that really FF201 is enough?	Or would I really want all
>three?  Thanks.
>
>Does Draco per chance run on a Sun 3 Berkeley Unix system?  In the
>best of possible worlds, I'd just be using one language.

Glad to oblige! I describe Draco as a language with semantics similar to
C (but more strongly typed) and syntax similar to Algol68 (but much less
ambiguous at the syntactic level). The compiler is complete, comes with a
full I/O and utility library, comes with a full set of include files for the
Amiga, and comes with a number of other utility programs. It compiles fast,
but still generates fairly good code. The only commercial compiler I've got
is Lattice V4.0, and Draco compares well with it (files are much smaller,
compiles much faster, and code runs about the same speed/size).

Holding to the maxim that a picture is worth a thousand words, here's a
silly little Draco program that compiles and runs:

#drinc:intuition/miscellaneous.g
#drinc:intuition/screen.g
#drinc:intuition/window.g
#drinc:graphics/gfx.g
#drinc:graphics/rastport.g
#drinc:libraries/dos.g

uint WINDOW_WIDTH = 500, WINDOW_HEIGHT = 150;

proc process(register *RastPort_t rp)void:
    register ulong i, j;

    for i from 0 upto WINDOW_WIDTH - 1 do
	for j from 0 upto WINDOW_HEIGHT - 1 do
	    SetAPen(rp, if i > j then (i - j) % 4 else (i + j) % 4 fi);
	    ignore WritePixel(rp, i + 2, j + 10);
	od;
    od;
    Delay(50 * 20);
corp;

proc main()void:
    *Window_t window;

    if OpenGraphicsLibrary(0) ~= nil then
	if OpenIntuitionLibrary(0) ~= nil then
	    window := OpenWindow(&NewWindow_t(
		    100, 50, WINDOW_WIDTH + 4, WINDOW_HEIGHT + 12,
		    FREEPEN, FREEPEN,
		    0x0, WINDOWDEPTH + WINDOWDRAG + SMART_REFRESH,
		    nil, nil, nil, nil, nil, 0, 0, 0, 0, WBENCHSCREEN));
	    if window ~= nil then
		process(window*.w_RPort);
		CloseWindow(window);
	    fi;
	    CloseIntuitionLibrary();
	fi;
	CloseGraphicsLibrary();
    fi;
corp;

It opens a window on the workbench screen, draws a kind of moire pattern into
it, waits 20 seconds, then exits. I compiled it by typing:

    draco sample

and linked it by typing

    dr1lib2 intuition graphics sample

to produce a 5100 byte object file (which, because I was lazy, mostly consists
of some of the Draco I/O library, and some symbolic information that I had
hanging around in my standard libraries). If I give it the '-v' flag, it tells
me that the first routine was actually 120 bytes, and the second was 140.

To reply to Jeff's specific questions:

At a minimum you need Fish Disks 77 and 201. 77 contains all the documentation
and a bunch of samples. 201 contains the latest released version of the
compiler, include files, libraries, scripts, tools, etc. 76 has info, etc. on
how to install the compiler, but you can probably do without it.

Draco doesn't YET run on a Sun, but I've been meaning to port it for about 2
years now. Mostly so I can port my editor so I don't have to wait 10 seconds
for emacs to page in and echo what I've typed on my Sun at work. I've got
some time off between Christmas and New-Years - maybe then... Note, however,
that a Sun version wouldn't automagically have all of the C libraries
available. It would have its I/O system (replaces stdio), and interfaces to
the system. There IS a kludge to make the compiler generate C-style calls,
but you have to reverse the function arguments, so that's a pain.

--
--
Chris Gray    usenet: {uunet,alberta}!myrias!ami-cg!cg	  CIS: 74007,1165