Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Other languages

11 views
Skip to first unread message

Roger Kenyon

unread,
Aug 6, 2001, 8:50:03 PM8/6/01
to
Has anybody ever attempted a parser with Smalltalk? If so, what were the
results?

I ask, in part, because Squeak (http://www.squeak.org/) uses a virtual
machine, is free, open-source, cross-platform, object-oriented, and
web-ready with a plug-in.

--

Roger Kenyon.

--
Posted from deimos.idirect.com [207.136.80.182]
via Mailgate.ORG Server - http://www.Mailgate.ORG

David Given

unread,
Aug 7, 2001, 7:00:44 AM8/7/01
to
In article <B794B374.B13%edu...@idirect.com>,

edu...@idirect.com (Roger Kenyon) writes:
> Has anybody ever attempted a parser with Smalltalk? If so, what were the
> results?
>
> I ask, in part, because Squeak (http://www.squeak.org/) uses a virtual
> machine, is free, open-source, cross-platform, object-oriented, and
> web-ready with a plug-in.

[It's also slow, clunky, has the user interface from hell, and is
generally unpleasant to use. Try GNU Smalltalk; which it doesn't have a
GUI, this also means it doesn't have the traditional Smalltalk UI (which
is unusable for stand-alone softwarre development). It's also faster.]

I haven't actually done IF programming in Smalltalk, but I have done some
general programming. It's a very nice language. It's completely
object-oriented; I believe it was the *first* OO language, and is still
the best.

The syntax is a bit funny. This Inform line:

object.method(param1, param2, param3)

...becomes:

object methodArg1: param1 arg2: param2 arg3: param3

This allows you to have much more sensible method names.

object moveContentsTo: location exceptFor: list

Everything's an object, including literals and code blocks. This:

1 + 2

...is sending the method + to 1, with argument 2. Exactly the same syntax
as above.

(x == y) ifTrue: [
...do stuff...
] ifFalse: [
...do more stuff...
]

...is Smalltalk's equivalent to if-else. ifTrue:ifFalse: is a method on
Boolean.

You can pass code blocks around. So you could easily define a method on
your IF object class:

player forAllContents: [ arg |
arg moveTo: nowhere.
]

Although this isn't really necessary; there's a whole set of iterators on
lists and things.

player contents iterate: [ arg |
arg moveTo: nowhere.
]

(player contents) returns the list of items inside the player. (list
iterate: []) iterates on that list.

The class library is fully featured and reasonably well laid out. The
language is garbage collected and has proper strings. It's not really
strongly or weakly typed; exactly what a method does when passed an object
of a type it's not expecting is up to the method; provided the object has
the correct interface, it'll just work. Numbers switch seamlessly from
ints to floats to bignums as required.

Actually, I think it would make a very nice IF language. Possibly it's a
little big. Smalltalk is really designed for persistent systems. I once
wrote a database in it; the actual programming was trivial. I saved the
database by making a snapshot of the entire system, and then restoring
that snapshot when I wanted to reload. Unfortunately, GNU Smalltalk's
smallest snapshot was around 800kB.

Possibly for IF, which uses a small subset of the language, an
implementation like Tiny Smalltalk would be better. That'll run in a
64kB segment.

[Disclaimer: it's been a while. Some of the details of syntax and method
names may be wrong.]

--
+- David Given --------McQ-+ "'In my Father's house there are many mansions.'
| Work: d...@tao-group.com | I'd rather build my own, than rent from you, thank
| Play: d...@cowlark.com | you very much anyway." --- Mark Atwood on rasfw
+- http://www.cowlark.com -+

Magnus Olsson

unread,
Aug 7, 2001, 9:05:05 AM8/7/01
to
In article <sohok9...@127.0.0.1>, David Given <d...@pearl.tao.co.uk> wrote:
>I haven't actually done IF programming in Smalltalk, but I have done some
>general programming. It's a very nice language. It's completely
>object-oriented; I believe it was the *first* OO language, and is still
>the best.

The first OO language is generally considered to be Simula, which dates
back to the mid-60's; it's descended from Algol 60 in the same way as
C++ is descended from C. I believe Smalltalk was the langauge that made
OOP popular, or at least talked about.


As a curiosity, the CS department at Lund University used Simula in some
programming courses at least as recently as the early 90's.

--
Magnus Olsson (m...@df.lth.se, m...@pobox.com)
------ http://www.pobox.com/~mol ------

Tobias Andersson

unread,
Aug 7, 2001, 10:08:16 AM8/7/01
to

> The first OO language is generally considered to be Simula, which dates

Well... let's start a HOLY WAR!!! ;-)

In the beginning Simula had the same OOP concepts as Java has today (even a
crude threading mechanism using detach/resume). But SmallTalk was *truly*
object oriented. The "INTEGER" in simula is a simple placeholder for a
value -- as it is in C for instance. In SmallTalk the "integer" is infact a
class. And when you declare an instance of the class SmallTalk automagically
creates an integer *object* for you. It was the first time the "everything
an object"-philosophy was implemented.

You can declare new classes which inherrits from the "integer class" if you
wish. I think this makes SmallTalk "more" object oriented then good-old
Simula67.

But I agree with you on this: Simula showed us the way! Not Java (as all the
undergrads seem to think nowadays).

> As a curiosity, the CS department at Lund University used Simula in some
> programming courses at least as recently as the early 90's.

Up here in Stockholm at KTH/NADA Simula was used in the introductory OOP
course for the last time in 1997. They have now switched to Java... It makes
me sad.

"Magnus Olsson" <m...@df.lth.se> skrev i meddelandet
news:9kop21$gum$1...@news.lth.se...

Magnus Olsson

unread,
Aug 7, 2001, 11:49:10 AM8/7/01
to
In article <9kosf0$5e6th$1...@ID-71633.news.dfncis.de>,

Tobias Andersson <tobias.NOSP...@optosweden.se> wrote:
>
>> The first OO language is generally considered to be Simula, which dates
>
>Well... let's start a HOLY WAR!!! ;-)

I'd rather not. :-)

>In the beginning Simula had the same OOP concepts as Java has today (even a
>crude threading mechanism using detach/resume). But SmallTalk was *truly*
>object oriented. The "INTEGER" in simula is a simple placeholder for a
>value -- as it is in C for instance. In SmallTalk the "integer" is infact a
>class.

By that standard, C++ isn't OO either, nor is Inform. And, yes, the
distinction between classes and PODs (Plain Old Data) in C++ can be
a pain in the backside at times. But not very often.

>But I agree with you on this: Simula showed us the way!

That's what I meant.

>> As a curiosity, the CS department at Lund University used Simula in some
>> programming courses at least as recently as the early 90's.
>
>Up here in Stockholm at KTH/NADA Simula was used in the introductory OOP
>course for the last time in 1997. They have now switched to Java...

As has Lund (at least they were using Java the last time I head
anything about it).

> It makes me sad.

But Java looks better than Simula on your resumé.

TheCycoONE

unread,
Aug 7, 2001, 4:56:32 PM8/7/01
to

> The first OO language is generally considered to be Simula, which dates
> back to the mid-60's; it's descended from Algol 60 in the same way as
> C++ is descended from C. I believe Smalltalk was the langauge that made
> OOP popular, or at least talked about.

Well we could go farther with the C thing. C is a decendent of B which was
a decendent of A which was the decendent of a primitive language called
Alpha.


Magnus Olsson

unread,
Aug 7, 2001, 5:26:54 PM8/7/01
to
In article <tn0ldqf...@corp.supernews.com>,

Close, but no cigar.

C is indeed descended from B, but B is descended from BCPL. And, yes,
I can provide you with references if you need them.

Kevin Forchione

unread,
Aug 7, 2001, 10:05:40 PM8/7/01
to
"Magnus Olsson" <m...@df.lth.se> wrote in message
news:9kpmeu$noc$1...@news.lth.se...

> In article <tn0ldqf...@corp.supernews.com>,
> TheCycoONE <cyc...@hotmail.com> wrote:
> >
> >> The first OO language is generally considered to be Simula, which dates
> >> back to the mid-60's; it's descended from Algol 60 in the same way as
> >> C++ is descended from C. I believe Smalltalk was the langauge that made
> >> OOP popular, or at least talked about.
> >
> >Well we could go farther with the C thing. C is a decendent of B which
was
> >a decendent of A which was the decendent of a primitive language called
> >Alpha.
>
> Close, but no cigar.
>
> C is indeed descended from B, but B is descended from BCPL. And, yes,
> I can provide you with references if you need them.

Very interesting. But on the use of Smalltalk for IF, how do you rate it?
I've played about with Squeak, and I have to say that it is going to be a
bit of a learning curve for me.

TADS 3 is an excellent choice of languages for IF, by the way. ;)

--Kevin


Billy Harris

unread,
Aug 8, 2001, 12:13:06 AM8/8/01
to
In article <9kpmeu$noc$1...@news.lth.se>, Magnus Olsson <m...@df.lth.se>
wrote:

>> >Well we could go farther with the C thing. C is a decendent of B
which was
> >a decendent of A which was the decendent of a primitive language called
> >Alpha.
>
> Close, but no cigar.
>
> C is indeed descended from B, but B is descended from BCPL.

More trivia: BCPL was orignally intended to be the first of a series of
5 languages; B was explictly the second in the series and C the third.
Hence C++ really should be named P.

TheCycoONE

unread,
Aug 7, 2001, 9:35:48 PM8/7/01
to

"Magnus Olsson" <m...@df.lth.se> wrote in message
news:9kpmeu$noc$1...@news.lth.se...
> In article <tn0ldqf...@corp.supernews.com>,
> TheCycoONE <cyc...@hotmail.com> wrote:
> >
> >> The first OO language is generally considered to be Simula, which dates
> >> back to the mid-60's; it's descended from Algol 60 in the same way as
> >> C++ is descended from C. I believe Smalltalk was the langauge that made
> >> OOP popular, or at least talked about.
> >
> >Well we could go farther with the C thing. C is a decendent of B which
was
> >a decendent of A which was the decendent of a primitive language called
> >Alpha.
>
> Close, but no cigar.
>
> C is indeed descended from B, but B is descended from BCPL. And, yes,
> I can provide you with references if you need them.
>
Odd, I have references too... it did all come from Alpha?


Magnus Olsson

unread,
Aug 8, 2001, 7:11:01 AM8/8/01
to
In article <tn26j2m...@corp.supernews.com>,

Well, I can point you directly to the horse's mouth: Dennis Ritchie,
in an academic paper, gives a quite detailed history of C:

Ritchie: The Development of the C Language, presented at Second
History of Programming Languages conference, Cambridge, Mass., April,
1993.

The entire paper is available at

http://cm.bell-labs.com/cm/cs/who/dmr/chist.html

And yes, Ritchie is the "R" in K&R. He actually invented the
language, so he ought to know. :-)

Richard Bos

unread,
Aug 8, 2001, 7:03:39 AM8/8/01
to
Billy Harris <wha...@mail.airmail.net> wrote:

> More trivia: BCPL was orignally intended to be the first of a series of
> 5 languages; B was explictly the second in the series and C the third.
> Hence C++ really should be named P.

Not true. Read K&R, or the link Magnus posted: when BCPL was created,
nobody had thought of C yet. B was created based on BCPL. C was based on
B; the name "C" was explicitly ambiguous, and I don't think it was ever
revealed whether C was C because of ABCDEFG... or because of BCPL.
Probably, both are half true, and the decision between D and P for the
next-generation C would've been meaningless.

Richard

Martin Julian DeMello

unread,
Aug 8, 2001, 2:36:33 PM8/8/01
to
Roger Kenyon <edu...@idirect.com> wrote:
: Has anybody ever attempted a parser with Smalltalk? If so, what were the

: results?
:
: I ask, in part, because Squeak (http://www.squeak.org/) uses a virtual
: machine, is free, open-source, cross-platform, object-oriented, and
: web-ready with a plug-in.

Ruby might be worth a look too - it's a sort of cross between Smalltalk and
Perl - pure OO, but perlish syntactic sugar, regexps, etc. From the Pickaxe
book:

Take a true object-oriented language, such as Smalltalk. Drop the
unfamiliar syntax and move to more conventional, file-based source code.
Now add in a good measure of the flexibility and convenience of
languages such as Python and Perl.

You end up with Ruby.

OO aficionados will find much to like in Ruby: things such as pure
object orientation (everything's an object), metaclasses, closures,
iterators, and ubiquitous heterogeneous collections. Smalltalk users
will feel right at home (and C++ and Java users will feel jealous).

At the same time, Perl and Python wizards will find many of their
favorite features: full regular expression support, tight integration
with the underlying operating system, convenient shortcuts, and dynamic
evaluation.

One down side is that most of the documentation is in Japanese (though
that's improving now, and there's a very helpful and friendly newsgroup
(comp.lang.ruby)). Another is that it's a very young language, and lacks
anything as comprehensive as CPAN.

Useful links: www.rubycentral.com for general ruby links
http://www.rubycentral.com/book/index.html for an online book

Someone's even started on a text adventure -
http://www.ruby-lang.org/en/raa-list.rhtml?name=adv

--
Martin DeMello

John West McKenna

unread,
Aug 8, 2001, 4:14:45 PM8/8/01
to
Martin Julian DeMello <mdem...@sei.owlnet.rice.edu> writes:

>Ruby might be worth a look too - it's a sort of cross between Smalltalk and
>Perl - pure OO, but perlish syntactic sugar, regexps, etc. From the Pickaxe
>book:

I got as far as question 6.5 in the FAQ:

a+b
is a legal expression.
a + b
is too. But
a +b
is not. Whitespace is significant in subtler than normal ways. This
doesn't strike me as a language for casual programmers.

Lua is nice. Whitespace (including newlines) is ignored, except where it's
needed to separate tokens. There are also no statement separators or
terminators (the semicolons that all beginners forget), and very little
magic punctuation. It's a language designed to be easy for non-programmers
to pick up, but still has the flexibility to satisfy Real Programmers.

No OO in the language itself, but it's trivial to add (through the scarily
powerful meta-language facilities). Custom OO that works in exactly the
way that your application needs.

http://www.lua.org

John

wo...@one.net

unread,
Aug 8, 2001, 6:00:09 PM8/8/01
to

Hi Roger,

>Has anybody ever attempted a parser with Smalltalk? If so, what were the
>results?
>
>I ask, in part, because Squeak (http://www.squeak.org/) uses a virtual
>machine, is free, open-source, cross-platform, object-oriented, and
>web-ready with a plug-in.


If you're looking for a cross platform OOP try Python, more
specifically PAWS, which has already got a parser, library, and
documentation. :) Runs on 20+ OS's and counting!

I wouldn't have jumped in but somebody mentioned Ruby...

Respectfully,

Wolf

"The world is my home, it's just that some rooms are draftier than
others". -- Wolf

TheCycoONE

unread,
Aug 8, 2001, 8:59:50 PM8/8/01
to
Blast! Well I suppose that makes my book completely invalid. Thank you...
now to burn my book.


John Colagioia

unread,
Aug 10, 2001, 8:17:30 AM8/10/01
to
Roger Kenyon wrote:

> Has anybody ever attempted a parser with Smalltalk? If so, what were the
> results?

I actually have yet to see anybody build an object-oriented parser at all.
Most attempts I've seen have pitifully done what Inform does on purpose:
create a parser object.

Hmm...Does anyone know whether any work has been done in this area? I might
imagine that you'd end up with something of a state machine (each state
being an object), but again, I haven't seen anyone try it.


> I ask, in part, because Squeak (http://www.squeak.org/) uses a virtual
> machine, is free, open-source, cross-platform, object-oriented, and
> web-ready with a plug-in.

Squeak, alas, is HUGE and has possibly the most bizarre user interface I
have ever seen, barring such warped travesties as IBM's RealCD. However,
there are a handful of other nifty Smalltalk interpreters around which are
nearly as portable (as in, they come distributed as fairly clean C source
code).

Tim Budd's "Little Smalltalk"
(http://www.smalltalk.org/versions/LittleSmalltalk.html) would probably be
the easiest to get running, being 1800 lines of code and designed as an
example for his textbook.

However, that still doesn't solve the "I wouldn't know how to parse under
Smalltalk" problem, so I'm hoping someone else pipes up with a decent
reference.


John Colagioia

unread,
Aug 10, 2001, 8:22:47 AM8/10/01
to
Richard Bos wrote:

Likewise, the BCPL book out of Cambridge by BCPL's authors make statements
quite to the contrary, as if BCPL were poised to rule the world.

...heh...with its 36-bit wordlength...


Robotboy8

unread,
Aug 10, 2001, 6:10:04 PM8/10/01
to
>Well we could go farther with the C thing. C is a decendent of B which was
>a decendent of A which was the decendent of a primitive language called
>Alpha.

Well technically Alpha would have been a descendant of both Assembly and
English, no?

--
If I say so then it is so; if it is so, it's probably because I said so.

TheCycoONE

unread,
Aug 10, 2001, 6:27:02 PM8/10/01
to

"Robotboy8" <robo...@aol.com> wrote in message
news:20010810181004...@mb-mk.aol.com...

> >Well we could go farther with the C thing. C is a decendent of B which
was
> >a decendent of A which was the decendent of a primitive language called
> >Alpha.
>
> Well technically Alpha would have been a descendant of both Assembly and
> English, no?

Assembly a decendent of Machine Language, English a decendent mainly of
Anglo and the latin languages (as well as pretty much everything else) we
could go a long way with this.


TheCycoONE

unread,
Aug 10, 2001, 6:46:12 PM8/10/01
to

"Magnus Olsson" <m...@df.lth.se> wrote in message
news:9kpmeu$noc$1...@news.lth.se...
> In article <tn0ldqf...@corp.supernews.com>,
> TheCycoONE <cyc...@hotmail.com> wrote:
> >
> >> The first OO language is generally considered to be Simula, which dates
> >> back to the mid-60's; it's descended from Algol 60 in the same way as
> >> C++ is descended from C. I believe Smalltalk was the langauge that made
> >> OOP popular, or at least talked about.
> >
> >Well we could go farther with the C thing. C is a decendent of B which
was
> >a decendent of A which was the decendent of a primitive language called
> >Alpha.
>
> Close, but no cigar.
>
> C is indeed descended from B, but B is descended from BCPL. And, yes,
> I can provide you with references if you need them.

Well it was kind of an alphabetic thing! I knew it was. BCPL (which was a
variation on CPL, but ignore that) came from ALGOL. A language which
happens to start with A.


Greg Ewing

unread,
Aug 12, 2001, 11:05:44 PM8/12/01
to
> >Well we could go farther with the C thing. C is a decendent of B which was
> >a decendent of A which was the decendent of a primitive language called
> >Alpha.

No, 'A' was descended from '@' which was descended
from '>' which was descended from '<' which...

Thus, we can see that all programming languages are
ultimately descended from one primitive proto-language
called NUL, details of which are lost in the mists
of time.

--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg

John Colagioia

unread,
Aug 13, 2001, 8:54:31 AM8/13/01
to
Greg Ewing wrote:

> > >Well we could go farther with the C thing. C is a decendent of B which was
> > >a decendent of A which was the decendent of a primitive language called
> > >Alpha.
> No, 'A' was descended from '@' which was descended
> from '>' which was descended from '<' which...
> Thus, we can see that all programming languages are
> ultimately descended from one primitive proto-language
> called NUL, details of which are lost in the mists
> of time.

Don't be silly. The specification has lived until this day. It's a very simple
and elegant language. Just look at the expressive power of the following program:

-Begin Example-
-End Example-
Wild, eh? The program, itself, doesn't actually accomplish much, but it almost
speaks to your soul as it does(n't do) it, no...?


David Given

unread,
Aug 13, 2001, 7:12:38 AM8/13/01
to
In article <3B73D0DA...@csi.com>,
John Colagioia <JCola...@csi.com> writes:
[...]

> Tim Budd's "Little Smalltalk"
> (http://www.smalltalk.org/versions/LittleSmalltalk.html) would probably be
> the easiest to get running, being 1800 lines of code and designed as an
> example for his textbook.

...unfortunately I can't get it to work; it all compiles, but it seg
faults whenever you try to parse any Smalltalk expressions. I thought that
maybe the image was corrupted, and so tried rebuilding that, but it kept
bombing out with a parse error.

[Glossary: `image' --- Smalltalk is persistant. This means that the entire
state of the system is supposed to be retained when the system's shut
down. In the real world, this isn't considered terribly useful, so what
Little Smalltalk does is to save a snapshot of the system just after
loading all the basic classes and libraries. This is the image. When you
want to use the system, that image is loaded and your Smalltalk system is
ready to go. You can then save further images with more code and data
contained.)

(Rather like Z-machine savegames, actually.)

> However, that still doesn't solve the "I wouldn't know how to parse under
> Smalltalk" problem, so I'm hoping someone else pipes up with a decent
> reference.

Probably your best bet is to find a decent OO parser --- how's Platypus?
--- and port that. Smalltalk's got real string support but it's probably
not necessary.

--
+- David Given --------McQ-+

| Work: d...@tao-group.com | No lawyers were harmed in the creation of this
| Play: d...@cowlark.com | post. I'll try harder next time.
+- http://www.cowlark.com -+

Andrew Plotkin

unread,
Aug 13, 2001, 10:43:15 AM8/13/01
to
Greg Ewing <gr...@cosc.canterbury.ac.nz> wrote:
>> >Well we could go farther with the C thing. C is a decendent of B which was
>> >a decendent of A which was the decendent of a primitive language called
>> >Alpha.

> No, 'A' was descended from '@' which was descended
> from '>' which was descended from '<' which...

> Thus, we can see that all programming languages are
> ultimately descended from one primitive proto-language
> called NUL, details of which are lost in the mists
> of time.

The legends say that there's only one NUL program, and it doesn't do
anything. This is why other languages evolved.

However, the legends are clearly bullshit, because we all know that
they didn't speak ASCII back then. They spoke EBCDIC.

--Z

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
*
* Make your vote count. Get your vote counted.

Richard Bos

unread,
Aug 13, 2001, 10:39:54 AM8/13/01
to
Andrew Plotkin <erky...@eblong.com> wrote:

> Greg Ewing <gr...@cosc.canterbury.ac.nz> wrote:
>
> > No, 'A' was descended from '@' which was descended
> > from '>' which was descended from '<' which...
>
> > Thus, we can see that all programming languages are
> > ultimately descended from one primitive proto-language
> > called NUL, details of which are lost in the mists
> > of time.
>
> The legends say that there's only one NUL program, and it doesn't do
> anything. This is why other languages evolved.
>
> However, the legends are clearly bullshit, because we all know that
> they didn't speak ASCII back then. They spoke EBCDIC.

The legends are correct. They are, however, badly spelled these days.
Now we mostly use ASCII, the difference seems slight, but the legends
originally spoke of the null program, and the null language. In ASCII,
of course, 0 == NUL == null; in those days, though, this might not have
been true, as you so perceptively note. But the Legendary Ones knew
this; that's why they wrote "null", not "NUL".

Richard

John Colagioia

unread,
Aug 14, 2001, 8:24:10 AM8/14/01
to
Richard Bos wrote:

Ah, but you're overlooking one critical detail. EBCDIC is a relatively
recent, human invention. ASCII, on the other hand, was bestowed to the
ancient Atlanteans by aliens (from space--not run-of-the-mill foreigners),
in exchange for twenty-four dollars in trinkets, a gingerbread house, and a
pair of fourteen-pound sledgehammers. With nothing to use ASCII for,
however, the Atlanteans merely hid their knowledge in the collective
unconscious memory of humanity, waiting for its day in the sun.


John Colagioia

unread,
Aug 14, 2001, 8:46:12 AM8/14/01
to
David Given wrote:

> In article <3B73D0DA...@csi.com>,
> John Colagioia <JCola...@csi.com> writes:
> [...]
> > Tim Budd's "Little Smalltalk"
> > (http://www.smalltalk.org/versions/LittleSmalltalk.html) would probably be
> > the easiest to get running, being 1800 lines of code and designed as an
> > example for his textbook.
> ...unfortunately I can't get it to work; it all compiles, but it seg
> faults whenever you try to parse any Smalltalk expressions. I thought that
> maybe the image was corrupted, and so tried rebuilding that, but it kept
> bombing out with a parse error.

Oops! I should have checked that out before posting. I know I have a running
copy...ah. It's a v3 compile. From...the CMU AI repository. You can get a
buildable copy (though out of date) and executables for a handful of machines
at:
http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/st/impl/little/

Meanwhile, I looked at the v4 problem, and it looks like the last line in the
"library source" is a problem ("begin nil main"). Alas, I don't know enough
Smalltalk to figure out what the problem is, quite yet.


> [Glossary: `image' --- Smalltalk is persistant.

[...]

> (Rather like Z-machine savegames, actually.)

Very much so, yes. The major difference, conceptually, is that you can have a
separate library loaded for run-time with the Smalltalk image, which you can
then build your program on.


> > However, that still doesn't solve the "I wouldn't know how to parse under
> > Smalltalk" problem, so I'm hoping someone else pipes up with a decent
> > reference.
> Probably your best bet is to find a decent OO parser --- how's Platypus?

Well, you see, that was my point at the top of the previous post. I've never
seen an actual "object-oriented parser." I've seen parsers in C++ and Java, but
they were little more than transcriptions of the "Dragon Book" code.


> --- and port that. Smalltalk's got real string support but it's probably
> not necessary.

Depends how you want to go about parsing. If you could arrange a "statement
class" that would break itself down into component parts, that might be useful.


Richard Bos

unread,
Aug 14, 2001, 8:35:32 AM8/14/01
to
John Colagioia <JCola...@csi.com> wrote:

> Richard Bos wrote:
>
> > The legends are correct. They are, however, badly spelled these days.
> > Now we mostly use ASCII, the difference seems slight, but the legends
> > originally spoke of the null program, and the null language.
>

> Ah, but you're overlooking one critical detail. EBCDIC is a relatively
> recent, human invention. ASCII, on the other hand, was bestowed to the
> ancient Atlanteans by aliens

Always knew ASCII was an invention of Cthulhu. Fnord. Mind you, EBCDIC
show all the hallmarks of an Illuminati tool, as well.

Richard

David Given

unread,
Aug 14, 2001, 3:13:54 PM8/14/01
to
In article <3B791D94...@csi.com>,

John Colagioia <JCola...@csi.com> writes:
[...]
> Oops! I should have checked that out before posting. I know I have a running
> copy...ah. It's a v3 compile. From...the CMU AI repository. You can get a
> buildable copy (though out of date) and executables for a handful of machines
> at:

[replying to your message again because my own hasn't shown up here yet]

I've done some more playing with pdst and, I'm pleased to say, now have
the very first Smalltalk adventure game[1]!

http://www.cowlark.com/Personal/advent.st

Okay, it's got three rooms. Okay, you can't actually do anything other
than walk about or quit. But for an hour's work I don't think it's that
bad.

[1] That I know of.

--
+- David Given --------McQ-+ "I've just had a terrible thought --- what if all
| Work: d...@tao-group.com | Earthlike planets other than our own *do* look like
| Play: d...@cowlark.com | Welsh quarries?" --- Coyu, on rasfw, while
+- http://www.cowlark.com -+ discussing _Blakes 7_

David Given

unread,
Aug 14, 2001, 12:27:38 PM8/14/01
to
In article <3B791D94...@csi.com>,

John Colagioia <JCola...@csi.com> writes:
[...]
> Oops! I should have checked that out before posting. I know I have a running
> copy...ah. It's a v3 compile. From...the CMU AI repository. You can get a
> buildable copy (though out of date) and executables for a handful of machines
> at:
> http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/st/impl/little/

I managed to find this:

ftp://test.albemarle.cc.nc.us/pub/deh/pdst/dst

It works, and seems to be even smaller the Little Smalltalk, but needs a
little (fairly obvious) fixing to make it go. And there's no
documentation. I've got it to a prompt, and typing 1+1 returns 2, but I'm
not sure what to do with it now.

[fiddles]

Aha.

> (1 to: 10) do: [ :i | ('i is ', i) print. ]
i is 1
i is 2
i is 3
i is 4
i is 5
i is 6
i is 7
i is 8
i is 9
i is 10
Interval ( 1 2 3 4 5 6 7 8 9 10 )
free: 7435
>

Yes, that seems to work rather nicely, but I hope the garbage collector's
implemented.

(For non-Smalltalk-heads: the line mentioned above is a for loop. (1 to:
10) returns an Interval object. The do: method executes the block --- the
thing in the square brackets --- once per entry in the Interval, passing
in the value each time; the :i is the parameter. The , method on a string
concatenates something to it, and you can probably guess what the print
method does.)

--

John Colagioia

unread,
Aug 16, 2001, 11:17:11 AM8/16/01
to
David Given wrote:

> In article <3B791D94...@csi.com>,
> John Colagioia <JCola...@csi.com> writes:
> [...]
> > Oops! I should have checked that out before posting. I know I have a running
> > copy...ah. It's a v3 compile. From...the CMU AI repository. You can get a
> > buildable copy (though out of date) and executables for a handful of machines
> > at:
> > http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/st/impl/little/
> I managed to find this:
> ftp://test.albemarle.cc.nc.us/pub/deh/pdst/dst
> It works, and seems to be even smaller the Little Smalltalk, but needs a
> little (fairly obvious) fixing to make it go.

Which of the versions are you using? I tried what I assume to be the latest, but
after what I thought were the three obvious fixes, it bombs out creating the image.

And...drat. Little STv3 and PDST aren't quite compatible, apparently. I can't even
get the loop you mentioned to run. Embarassing as this might be for me, could I
convince you to more explicitly walk me through the obvious changes, just to make
sure I'm not a raving idiot?

Plus, I'm not sure it's so small...but that's another discussion, entirely.

[...]


David Given

unread,
Aug 16, 2001, 12:40:20 PM8/16/01
to
In article <3B7BE3F7...@csi.com>,

John Colagioia <JCola...@csi.com> writes:
[...]
> Which of the versions are you using? I tried what I assume to be the latest, but
> after what I thought were the three obvious fixes, it bombs out creating the image.
>
> And...drat. Little STv3 and PDST aren't quite compatible, apparently. I can't even
> get the loop you mentioned to run. Embarassing as this might be for me, could I
> convince you to more explicitly walk me through the obvious changes, just to make
> sure I'm not a raving idiot?

Okay.

Download ftp://test.albemarle.cc.nc.us/pub/deh/pdst/dst/0004.pdst.tar.gz.
Edit pdst.c, and apply this patch:

---snip---
3655c3655
< if(ptrEq(strRef = primGetChunk((objRef *) &tagRef).ptr, (objRef) nilObj))
---
> if(ptrEq((objRef) (strRef = primGetChunk((objRef *) &tagRef).ptr), (objRef) nilObj))
3668c3668
< while(ptrNe(strRef = primGetChunk((objRef *) &tagRef).ptr, (objRef) nilObj)) {
---
> while(ptrNe((objRef) (strRef = primGetChunk((objRef *) &tagRef).ptr), (objRef) nilObj)) {
3689c3689
< while(ptrNe(strRef = primGetChunk((objRef *) &tagRef).ptr, (objRef) nilObj)) {
---
> while(ptrNe((objRef) (strRef = primGetChunk((objRef *) &tagRef).ptr), (objRef) nilObj)) {
---snip---

Compile with:

gcc -Wall -O2 -o pdst pdst.c -lm

Then do this to build the initial image:

./pdst -c initial.st

Now you can do this to start the shell:

./pdst -w

At this point you download my nifty adventure, and do:

File new fileIn: 'advent.st'

...to run it.

You're right; it's not nearly as small as I originally thought it was.
It's nearly five thousand lines of C (plus three thousand of Smalltalk),
and judging by the size of the system image is fairly profligate in its
use of memory... I reckon a Z-machine port is probably not feasible.

OTOH, I could get it to work, unlike Little Smalltalk.

--
+- David Given --------McQ-+ "Hydrogen fusion, the sun makes shine
| Work: d...@tao-group.com | Vascular pressure makes the ivy twine.
| Play: d...@cowlark.com | Because of Rayleigh, the sky's so blue.
+- http://www.cowlark.com -+ Hormonal fixation is why I love you." --- Zarf

John Colagioia

unread,
Aug 16, 2001, 1:50:26 PM8/16/01
to
I see your response on Google, but I don't have a copy. So, I get to screw up threading
some, too!

John Colagioia wrote:
[...]

> Which of the versions are you using? I tried what I assume to be the latest, but
> after what I thought were the three obvious fixes, it bombs out creating the image.

Turns out I'm not a complete idiot. Your patch and mine were identical. The problem
(for anyone else reading along at the moment) was that I'm on a Windows machine and
PDST's files need UNIX-like end-of-line markers (i.e., just the LF, rather than the
LF/CR pair). Otherwise, it can't read anything past the first line, which obviously
makes for a bad system image.

I had to convert your game, too. Or, rather, re-convert it, since I converted it to
read through it...

But, yes. For an hour's worth of work, I'd say that's pretty impressive progress. Now,
we just need a parser. I'm working on it...

[...]


Sean T Barrett

unread,
Aug 16, 2001, 2:59:39 PM8/16/01
to
In article <k1tgl9...@127.0.0.1>, David Given <d...@pearl.tao.co.uk> wrote:
>You're right; it's not nearly as small as I originally thought it was.
>It's nearly five thousand lines of C (plus three thousand of Smalltalk),

If anybody wants to implement IF in Forth, there's a sixty-line
implementation of Forth at http://www.ioccc.org/1992/buzzard.2.c

SeanB
(actually requires a fair amount of "library" code to get true Forth from it)

David Given

unread,
Aug 17, 2001, 6:30:29 AM8/17/01
to
In article <3B7C07E2...@csi.com>,

John Colagioia <JCola...@csi.com> writes:
[...]
> Turns out I'm not a complete idiot. Your patch and mine were identical. The problem
> (for anyone else reading along at the moment) was that I'm on a Windows machine and
> PDST's files need UNIX-like end-of-line markers (i.e., just the LF, rather than the
> LF/CR pair). Otherwise, it can't read anything past the first line, which obviously
> makes for a bad system image.

...and the moral of that story is obvious.

[...]


> But, yes. For an hour's worth of work, I'd say that's pretty impressive progress. Now,
> we just need a parser. I'm working on it...

I've been thinking about that, and I reckon that pure Smalltalk's probably
a really lousy language to use as a *raw* IF system. One problem is that
IF tends to make a lot of use of singleton classes, and Smalltalk's not
really much good at that. For example, in my game I had to create all the
rooms before I initialised them.

I think what we need is a preprocessor. Something that reads in a script
file and generates all the appropriate objects. We could do a lot worse
than copy Inform's syntax...

Prop RedKey
properties [
name := #('red' 'key').
polished := false
],
methods [
PolishWith: o [
(o == ChamoisLeather) ifTrue: [
player tell: 'You buff up the key nicely.'.
polished := true.
^true
].
^false
]
]

...would become:

Prop subclass: #RedKeyClass instanceVariableNames: 'name polished' !
{!
RedKey methods !
init
name := #('red' 'key').
polished := false
!

PolishWith: o
(o == ChamoisLeather)
...etc...
}!

RedKey = RedKeyClass new !

This would also allow some extra error reporting, which pdst is currently
very bad at. I had a lot of trouble finding some trivial syntax errors
that would prevent compilation.

Another problem is saving the program once we're done. An empty pdst image
with the standard classes and nothing else is 700kB... but that does
include all the source for those classes. Considering that there will be
no difference between a game file and a save file in this putative system,
it would be really nice to slim it down a bit.

--
+- David Given --------McQ-+ "[One shot of the Death Star's superlaser has
| Work: d...@tao-group.com | enough power] to send Marty McFly to the Big Bang
| Play: d...@cowlark.com | and back 1.4x10^29 times." --- William Clifford
+- http://www.cowlark.com -+

John Colagioia

unread,
Aug 17, 2001, 9:40:57 AM8/17/01
to
David Given wrote:

> In article <3B7C07E2...@csi.com>,
> John Colagioia <JCola...@csi.com> writes:
> [...]
> > Turns out I'm not a complete idiot. Your patch and mine were identical. The problem
> > (for anyone else reading along at the moment) was that I'm on a Windows machine and
> > PDST's files need UNIX-like end-of-line markers (i.e., just the LF, rather than the
> > LF/CR pair). Otherwise, it can't read anything past the first line, which obviously
> > makes for a bad system image.
> ...and the moral of that story is obvious.

Heh...Yeah, "write your [various expletives deleted] code independant of whitespace
conventions."


> [...]
> > But, yes. For an hour's worth of work, I'd say that's pretty impressive progress. Now,
> > we just need a parser. I'm working on it...
> I've been thinking about that, and I reckon that pure Smalltalk's probably
> a really lousy language to use as a *raw* IF system. One problem is that
> IF tends to make a lot of use of singleton classes, and Smalltalk's not
> really much good at that. For example, in my game I had to create all the
> rooms before I initialised them.

The way I might be inclined to handle something like this (assuming I knew enough Smalltalk to
do so, which I don't quite, at the moment) would be to dynamically instantiate the objects as
necessary, wrapping the constructor to handle the initialization.

Obviously, a more generic version of this would need to be provided by the standard library,
if such a facility doesn't already exist (like it does in C++ et al, with parameterized
constructors).


> I think what we need is a preprocessor. Something that reads in a script
> file and generates all the appropriate objects. We could do a lot worse
> than copy Inform's syntax...

That's another way of handling it, yes. Of course, by then, you're not quite using Smalltalk,
anymore, except as a virtual machine. Not that this is a necessarily bad thing (after all,
many compilers compile to C, after all), but it does strike me as being little more
"sophisticated" than just using Inform to begin with.

[...]

> This would also allow some extra error reporting, which pdst is currently
> very bad at. I had a lot of trouble finding some trivial syntax errors
> that would prevent compilation.

This is true. The implementation, as it stands, needs much more work on the error-handling
front.


> Another problem is saving the program once we're done. An empty pdst image
> with the standard classes and nothing else is 700kB... but that does
> include all the source for those classes. Considering that there will be
> no difference between a game file and a save file in this putative system,
> it would be really nice to slim it down a bit.

Well, in a special-purpose image (a game), it would probably be much smarter to rewrite the
library in its entirety, really, anyway, just to make sure it provides the services needed.


Matthew Russotto

unread,
Aug 20, 2001, 10:59:16 AM8/20/01
to
In article <9l8p23$frs$1...@news.panix.com>,

Andrew Plotkin <erky...@eblong.com> wrote:
>
>The legends say that there's only one NUL program, and it doesn't do
>anything. This is why other languages evolved.
>
>However, the legends are clearly bullshit, because we all know that
>they didn't speak ASCII back then. They spoke EBCDIC.

Isn't NUL in EBCDIC the same as NUL in ASCII, making NUL a
cross-charset programming language?
--
Matthew T. Russotto russ...@pond.com
=====
Get Caught Reading, Go To Jail!
A message from the Association of American Publishers
Free Dmitry Sklyarov! DMCA delenda est!
http://www.freedmitry.org

Jonadab the Unsightly One

unread,
Sep 1, 2001, 11:26:28 AM9/1/01
to
russ...@wanda.pond.com (Matthew Russotto) wrote:

> >The legends say that there's only one NUL program, and it doesn't do
> >anything. This is why other languages evolved.
> >
> >However, the legends are clearly bullshit, because we all know that
> >they didn't speak ASCII back then. They spoke EBCDIC.
>
> Isn't NUL in EBCDIC

All versions of EBCDIC, or just certain versions?

> the same as NUL in ASCII, making NUL a cross-charset programming language?

Heh. Is it the same in ZSCII too?

Incidentally, does anyone know why there's no ZBCDIC?

- jonadab

0 new messages