Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site ulowell.UUCP Path: utzoo!decvax!wanginst!ulowell!mod-amiga From: mod-amiga@ulowell.UUCP Newsgroups: mod.amiga Subject: Announcing a forthcoming new compiler. Message-ID: <474@ulowell.UUCP> Date: Fri, 20-Jun-86 11:01:11 EDT Article-I.D.: ulowell.474 Posted: Fri Jun 20 11:01:11 1986 Date-Received: Sat, 21-Jun-86 03:55:39 EDT Sender: page@ulowell.UUCP Organization: University of Lowell Lines: 134 Approved: page@ulowell.UUCP Reply-To: ...!ihnp4!alberta!myrias!cg (Chris Gray) Announcing an upcoming compiler "product" for the Amiga. Sometime in the next couple of months (hopefully), I will be releasing and probably posting (any objections?) the binary for a new compiler for the Amiga. The compiler is for a language of my own design, currently called "Draco" (I pronounce it 'Dray-Ko'). Syntactically, Draco is similar to Algol68 (if .. then .. elif .. else .. fi, etc.) with some simplifications. Semantically, it is a cross between Pascal and C. This latter means that Draco has most of the system-level features that C does (except bitfields for now) but has the type checking of Pascal. I should note that the version to be posted will be a preliminary version. The code generated won't be the best in the world, and there are some major language changes that I'm contemplating. The point behind the preliminary version is to get feedback on the language, the compiler and tools, the run-time libraries and the possible changes. The compiler is intended to be a "shareware" product - i.e. you can give it to anybody, so long as the "shareware" notice is kept intact, and you can't copyright it yourself or any other such thing. Also, the shareware notice will suggest that if you like it, you might consider sending me a small donation. Some history. The compiler is written in itself, and has grown up over the last three years, starting from a simple PDP-11 version up to the current CP/M-80 version. The compiler is small and fast, as is the linker. The 8080 object code for the 10,000 lines of source is 38K. With input and output to/from a large disk cache, it currently compiles (including conditional compilation, constant folding, peephole optimization, etc.) at about 2300 lines per minute, producing a relocatable object module. The linker is about 16K and links the compiler in about a minute (10 object files). Current state. Currently, I'm working on debugging a cross compiler version which runs on CP/M-80 and generates 68000 code. I've done a very minimal interface library using 'assem' on the Amiga, and I have a small program which converts my object format (more compact than others) into the Amiga format. Together, they allow me to compile programs on CP/M-80 and then link and run them on the Amiga. As of this week, I've run a recursive Towers of Hanoi, a program which handles a sorted linked list, and a matrix multiply function using conformant array parameters. I need to try larger and larger programs until I eventually try the compiler itself. I then need to get my run-time libraries converted to use AmigaDOS's functions, and write a program to produce an interface library based on the '.fd' files. (Anybody know how accurate the .fd files on the 1.1 Extras disk are?) I'm not sure whether I'll convert my linker before the first release, or whether I'll use the converter program and Alink. If Deep Thought takes half an hour to link the compiler, I'll almost certainly convert my linker. Is the compiler a practical alternative to C? I'd say yes. One friend and I have written about 40,000 lines using it, including a text processor, a screen editor, a custom database system, a structured language editor/ interpreter and a large graphic adventure system (which I plan to port after the compiler is done). I've used it for a customizable modem program and a small interrupt-driven application. Plus of course the compiler, linker, assembler, disassembler, librarian, run-time library and utility libraries. To give you a taste of the language, here is a compilable, but useless, program showing many of the constructs: #include mystuff.g bool DEBUG = false; int SIZE1 = 10, SIZE2 = SIZE1 * 2 + 1; byte BEL = 0x07; *char MESSAGE = "Hello \(BEL)there world\n"; type Value_t = unsigned SIZE2, Tree_t = struct { *Tree_t t_left, t_right; /* pointers to children */ Value_t t_value; /* this node's value */ }, Dictionary_t = [SIZE1, SIZE2] Tree_t; extern Exit(long errorCode)void; /* AmigaDOS's Exit routine */ channel output text TreeChannel; /* assume somebody opened it! */ proc printTree(Tree_t t)void: if t ~= nil then printTree(t*.t_left); if not writeln(TreeChannel; "Tree value: ", t*.t_value, '.') then /* write error on channel - file must be full or something */ Exit(20); fi; printTree(t*.t_right); fi; corp; proc main()void: type command_t = enum {cmd_quit, cmd_nop, cmd_error}; extern getCommand()command_t; command_t cmd; int i; while write("> "); /* looks Pascalish, but works right */ if DEBUG then /* this is conditional compilation */ writeln("calling 'getCommand'"); fi; cmd := getCommand(); cmd ~= cmd_quit do case cmd incase cmd_quit: writeln("Oh, no; a compiler bug!"); /* This isn't possible */ Exit(30); incase cmd_nop: ; incase cmd_error: for i from 1 upto 50 do write('*'); od; writeln(); default: writeln("Invalid command code from 'getCommand'"); Exit(31); esac; od; corp; I'm sure I've forgotten a couple of major things, but a close look should answer a lot of questions (and pose more!). Long live the Amiga! Chris Gray (...ihnp4!alberta!myrias!cg) P.S. If I can figure out how to read the screen size from the console driver, I'll post the Draco source and binary for a simple 'more' program.