MUD-Dev
mailing list archive
[ Other Periods
| Other mailing lists
| Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
Re: [MUD-Dev] Internal Mud Languages
[Jon L:]
:I have been attempting to decipher the LCC compiler which
:produces native 486 code. An implementation of C with all it's
:semantic/syntax complexities is quite a bit more than I had in
:mind.
:
:Can anyone point me to some very basic examples/documentation
:of these functions carried out completely?
"Amiga Transactor", V4 #'s 4-6, and V5 #1 contain a series of
articles on writing a small compiler. Now, that was in 1989 and I don't
imagine that copies are now easy to come by. However, since I wuz the
author (cough!), I happen to have the full sources and articles here
on my hard-drive. The compiler compiled a subset of my Draco language
into M68000 machine code. The whole thing is just 3260 lines of code,
with a fair amount of comments, plus the articles themselves. It does
not use any lexer generator or parser generator tools, etc. - it is
complete in itself. It is *not* a very big language, but I did manage
to write a small character-graphics target-shoot game in it. Here is
the classic in "Toy":
/*
* hanoi.t - standard "Towers of Hanoi" in toy.
*/
proc printPeg(int peg)void:
if peg = 1 then
write("left");
elif peg = 2 then
write("center");
else
write("right");
fi;
corp;
proc hanoi(int n, fromPeg, usingPeg, toPeg)void:
if n ~= 0 then
hanoi(n - 1, fromPeg, toPeg, usingPeg);
write("Move disk from ");
printPeg(fromPeg);
write(" peg to ");
printPeg(toPeg);
write(" peg.\n");
hanoi(n - 1, usingPeg, fromPeg, toPeg);
fi;
corp;
proc main()void:
int n;
write("How many pegs? ");
readln(n);
hanoi(n, 1, 2, 3);
corp;
--
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA
- Thread context:
- Re: [MUD-Dev] Resets, repops and quests, (continued)
- Re: [MUD-Dev] Resets, repops and quests,
Ling K.L.Lo-94#student,lut.ac.uk, Wed 28 May 1997, 00:33 GMT
- Re: [MUD-Dev] Resets, repops and quests,
clawrenc clawrenc#cup,hp.com, Sat 31 May 1997, 05:56 GMT
- Re: [MUD-Dev] Internal Mud Languages,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Tue 27 May 1997, 12:56 GMT
- Re: [MUD-Dev] Rooms, 3D arrays, etc.,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Mon 26 May 1997, 21:47 GMT
[ Other Periods
| Other mailing lists
| Search
]