real language

Bookmarking Digg Diigo DZone Earthlink Google
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language MAGIC/L

Author:Eric Korpela
Score: (3.01 in 141 votes)
A procedural language written in Forth.  Originally ran on 
Z80's under CP/M and later available for IBM-PCs and Sun 3s.

; MAGIC/L version of the beer bottle song 
; (c) 1996 Eric Korpela (
; WARNING! All the spaces are necessary!
; Add the help entry....
.subject bottles
Usage:  bottles ( number )
; and here's the procedure
define bottles 
  integer number
  local integer current
  current := number
  while ( current > 1 )
    print current , " bottles of beer on the wall."
    print current , " bottles of beer."
    print "You take one down and pass it around."
    current := current - 1
    print current , " bottles of beer on the wall."
  print 1 , " bottle of beer on the wall."
  print 1 , " bottle of beer."
  print "You take one down and pass it around."
  print "No bottles of beer on the wall.

Download Source | Write Comment

Alternative Versions


>>  Arny Epstein said on 06/03/09 03:33:52

Arny Epstein True History. Jeffrey D. Morris and I wrote MAGIC/L in 1979 while working a Smithsonian Astrophysical Observatory in Cambridge, MA. It was based on STOIC (Stack Oriented Incremental Compiler) an enhancement of FORTH written by Jonathan Sachs (also THE original programmer for Lotus 1-2-3). With MAGIC/L we got the productivity of FORTH but with maintainability (we added a Pascal-C hybrid syntax instead of having to maintain "reverse polish" code (see Byte Magazine 1980).

Eric's code above is good. It defines a subroutine that prints out that childhood song. The following code is briefer and will run interactively (the 'iter N' command has a "built-in" counter, i, that runs from 0 -> N-1 and i' that runs from N-1 to 0.

iter 100
print i'+1, " bottles of beer on the wall."
print i'+1, " bottles of beer."
print "You take one down and pass it around."
if( i' == 0 )
print "No bottles of beer on the wall."
print i' , " bottles of beer on the wall."

>>  Arny Epstein said on 06/03/09 03:46:33

Arny Epstein More History of MAGIC/L

MAGIC/L was used for data analysis and graphics display on the Einstein X-Ray observatory (a.k.a HEAO-B) which launched in Nov 1978. In 1978, our evolving language was called Jabberwock (Jeff and Arny's berry-berry wonderful compiler cluge), but we arrived at MAGIC (Mnemonics Are Generally Idiotic Concoctions) in early 1979.

In 1981, Jeff and I founded Loki Engineering which productized MAGIC/L and ported it from its original Data General Nova/Eclipse implementation to PDP-11, then VAX, then various 68000 Unix versions of the day. In 1982, Apple Computer licensed MAGIC/L for use in development -- first for testing and diagnosing the "Twiggy" drive on the Apple Lisa. Subsequently it was used in the Macintosh development group as an aide in the development of AppleTalk. It was subsequently ported to Solaris, Nat. Semi's 32032 processor-based unix, The Atari 512, CP/M, DOS, Windows 3, and Windows NT. Loki Engineering closed its doors in 1988.

>>  Carl Dobson said on 09/15/09 19:30:57

Carl Dobson Arny, is Magic/L archived somewhere on the net? It was a classic in the Forth family and it would be nice if it were preserved. Originally, it was written in DG Assembler, wasn't it? I don't recall how you ported it to all of those systems. Did you re-write it in C, or in Magic/L? If you have a copy of STOIC, it should also be preserved.

>>  david kuller said on 08/22/10 00:37:42

david kuller I development 10s of 1000s of lines of Magic/L at Digital Techniques Inc. on our interactive touchscreen computers when graphics and video overlay were a novelty.

best dev env ever!

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!




Security Code: