knowledge-database (beta)

Current group: comp.compilers

Syntax of SmallTalk

Syntax of SmallTalk  
Klaas-Jan Stol
 Re: Syntax of SmallTalk  
Davide Grandi
 Re: Syntax of SmallTalk  
Klaas-Jan Stol
 Re: Syntax of SmallTalk  
Tim Olson
 Re: Syntax of SmallTalk  
Lex Spoon
 Re: Syntax of SmallTalk  
Klaas-Jan Stol
 Re: Syntax of SmallTalk  
Nick Roberts
 Re: Syntax of SmallTalk  
Peter Ilberg
 Re: Syntax of SmallTalk  
Trevor Jenkins
From:Klaas-Jan Stol
Subject:Syntax of SmallTalk
Date:23 Dec 2004 21:36:17 -0500
Hello,

I'm looking for a *complete* grammar for SmallTalk. I've searched quite
a bit, but haven't been able to find anything. There doesn't seem to be
a SmallTalk grammar available. I'd like to create a SmallTalk port to
another VM. For that, I'd like the grammar in Yacc format, but any other
would be great, too.

Thanks in advance

klaas-jan
[Somebody asked 10 years ago and got no answers. so don't hold your breath.
-John]
From:Davide Grandi
Subject:Re: Syntax of SmallTalk
Date:25 Dec 2004 20:18:46 -0500
Klaas-Jan Stol wrote:

> I'm looking for a *complete* grammar for SmallTalk.

- try a post on comp.lang.smalltalk
- try a request on the Squeak mailing list (some time ago there were
something about a compiler switch from the OLD one to a new one
(?Smacc?))
- there are a couple of Smalltalk compiler compilers (Smacc, i.e.) they
should have a working grammar for Smalltalk
- many St books (and there are a dozen free on the net) includes a
grammar (for a human reader)

.... the usual google search give only 56 hits, and the first one is a
comp.compilers message of ten years ago ...

Best regards,

Davide Grandi
--
Ing. Davide Grandi
davide.grandi@mclink.it
From:Klaas-Jan Stol
Subject:Re: Syntax of SmallTalk
Date:Sat, 25 Dec 2004 18:19:25 GMT
it becomes necessary to hide the fact that you are eating
human babies, this is the perfect solution.
But if you are still paranoid, you can substitute pork butt.

5 lb. lean chuck roast
3 lb. prime baby butt
2 tablespoons each:
salt
black, white and cayenne peppers
celery salt
garlic powder
parsley flakes
brown sugar
1 teaspoon sage
2 onions
6 cloves garlic
bunch green onions, chopped

Cut the children?s butts and the beef roast into pieces
that will fit in the grinder.
Run the meat through using a 3/16 grinding plate.
Add garlic, onions and seasoning then mix well.
Add just enough water for a smooth consistency, then mix again.
Form the sausage mixture into patties or stuff into natural casings.



Stillborn Stew

By definition, this meat cannot be had altogether fresh,
but have the lifeless unfortunate available immediately after delivery,
or use high quality beef or pork roasts (it is cheaper and better to
cut up a whole roast than to buy stew meat).

1 stillbirth, de-boned and cubed
¼ cup vegetable oil
2 large onions
bell pepper
celery
garlic
½ cup red wine
3 Irish potatoes
2 large carrots

This is a simple classic stew that makes natural gravy,
thus it does not have to be thickened.
Brown the meat quickly in very hot oil, remove and set aside.
Brown the onions, celery, pepper and garlic.
De-glaze with wine, return meat to the pan and season well.
Stew on low fire adding small amounts of water and
seasoning as necessary.
After at least half an hour, add the carrots and potatoes,
and simmer till root vegetab
From:Tim Olson
Subject:Re: Syntax of SmallTalk
Date:25 Dec 2004 20:17:04 -0500
Klaas-Jan Stol wrote:


| I'm looking for a *complete* grammar for SmallTalk. I've searched quite
| a bit, but haven't been able to find anything. There doesn't seem to be
| a SmallTalk grammar available. I'd like to create a SmallTalk port to
| another VM. For that, I'd like the grammar in Yacc format, but any other
| would be great, too.

Perhaps you found it, but thought it wasn't complete because it was
too small! Smalltalk syntax is incredibly simple (Forth is the only
language I know which has a simpler syntax).

The BNF for Smalltalk can be found in the draft ANSI Smalltalk Standard
document; here's one reference:




[Note that there is an additional "file-out" syntax used to represent
Smalltalk in external text files, but that varies slightly between the
various implementations]

-- Tim Olson
[I think it's like Lisp in that the basic language is so low level that
it's easy to parse, but you can't tell much about the program after
you've done so. For usful analysis you need to know what a lot of the
standard operators do. -John]
From:Lex Spoon
Subject:Re: Syntax of SmallTalk
Date:19 Jan 2005 22:12:31 -0500
Tim Olson writes:
> [I think it's like Lisp in that the basic language is so low level that
> it's easy to parse, but you can't tell much about the program after
> you've done so. For usful analysis you need to know what a lot of the
> standard operators do. -John]

Yes, but since Smalltalk has no macros, it simplifies things compared
to Lisp. If you see something that looks like a message send, then it
is actually a message send. It's not something that will macro expand
at runtime into something completely different. (This simplifies the
code browsers, too; if you ask for all code that might invoke a
specified method, you can actually find them; there aren't hidden
senders lurking in the middle of pre-expanded macro code.)

On the other hand, control operators (if-then, while, throw-catch,
....) are all in the library, as are numeric operators. In theory, 3+4
might not invoke the addition operation, if the programmer has
redefined +.

Many compiler-writers simply assume that this won't happen for the
basic operations. They assume if they see a +, then it means "add".
On the other hand, if you use a dynamic translation approach like in
Self, it appears that you can leave the programmer the option to
redefine even very basic things, while still getting reasonably high
performance out of the compiler.



Overall, it's important to keep in mind Smalltalk's design strategy,
if you want to work with it. It's lead guy Alan Kay has attempted to
"late bind" as much as possible. He wants to leave as many things as
possible open to experimentation, because he never intended for
Smalltalk to be a done deal. His team completely rewrote the langugae
4-5 times throughout the 70's.... I'd guess this is a major reason
the core language is so tiny and so many things are in the library.

Nowadays, a lot of people use derivatives of Smalltalk-80 as a regular
industrial programming language; however, there are many researchers
around who very much want to keep around the extreme flexibility. As
a compiler writer, you should think carefully about which audience you
are targetting. The software developers don't care if you early bind
what + means, but the researchers would like to keep the possibility
of changing it around. To give you one idea, in Squeak, people have
implemented both continuations and exceptions without changing the
compiler; this was only possible because Squeak's compiler (and
bytecode interpreter) is a traditional late-binding one that doesn't
make many assumptions. On the other hand, Squeak's
compiler+interpreter runs code slower than that of Cincom VisualWorks.




LINKS

Check out the article in History of Programming Languages for more
info. Here's an HTML version of it:

http://gagne.homedns.org/%7etgagne/contrib/EarlyHistoryST.html


Or, grab it the PDF through the ACM portal if you have access:

http://portal.acm.org/citation.cfm?id=155364&coll=Portal&dl=ACM&CFID=36046258&CFTOKEN=2366809


Here's some info on the Self compiler:

http://research.sun.com/self/compiler.html


(blatant plug) Here's a project that includes a Smalltalk parser plus
some infrastructure to help with program analysis:

http://www.cc.gatech.edu/~lex/ti

But there is a ton of such stuff around.... As mentioned earlier, you
should really ask on the Squeak mailing list or on one of the
Smalltalk newsgroups if you have a more specific requirement.


-Lex Spoon
From:Klaas-Jan Stol
Subject:Re: Syntax of SmallTalk
Date:Sat, 25 Dec 2004 19:49:38 GMT
browning.
De-glaze with sherry, add the reduced broth.
Finally, put in the root vegetables and simmer for 15 minutes.
Allow to cool slightly.
Place the pie pan in 375 degree oven for a few minutes so bottom crust is not soggy,
reduce oven to 325.
Fill the pie with stew, place top crust and with a fork, seal the crusts together
then poke holes in top.
Return to oven and bake for 30 minutes, or until pie crust is golden brown.



Sudden Infant Death Soup

SIDS: delicious in winter, comparable to old fashioned Beef and Vegetable Soup.
Its free, you can sell the crib, baby clothes, toys, stroller... and so easy to
procure if such a lucky find is at hand (just pick him up from the crib and
he?s good to go)!

SIDS victim, cleaned
½ cup cooking oil
Carrots
onions
broccoli
whole cabbage
fresh green beans
potato
turnip
celery
tomato
½ stick butter
1 cup cooked pasta (macaroni, shells, etc.)

Remove as much meat as possible, cube, and brown in hot oil.
Add a little water, season, then add the carcass.
Simmer for half an hour keeping the stock thick.
Remove the carcass and add the vegetables slowly to the stock,
so that it remains boiling the whole time.
Cover the pot and simmer till vegetables are tender
(2 hours approximately).
Continue seasoning to taste.
Before serving, add butter and pasta,
serve piping with hot bread and butter.



Offspring Rolls

Similar to Vietnamese style fried rolls, they have lots of meat
(of course this can consist of chicken, beef, p
From:Nick Roberts
Subject:Re: Syntax of SmallTalk
Date:25 Dec 2004 20:18:08 -0500
Klaas-Jan Stol wrote:

> I'm looking for a *complete* grammar for SmallTalk. I've searched quite a
> bit, but haven't been able to find anything. There doesn't seem to be a
> SmallTalk grammar available. I'd like to create a SmallTalk port to
> another VM. For that, I'd like the grammar in Yacc format, but any other
> would be great, too.

My impression is that no such beast exists, and perhaps never has. The
nearest thing, I understand, to any kind of official definition for
the language is the 'blue book' (Smalltalk-80: The Language and It's
Implementation ISBN 0-201-11371-6, qv
http://www.smalltalk.org/smalltalk/history.html ). HTH

--
Nick Roberts
From:Peter Ilberg
Subject:Re: Syntax of SmallTalk
Date:25 Dec 2004 20:17:47 -0500
On 23 Dec 2004 21:36:17 -0500, Klaas-Jan Stol wrote:
> I'm looking for a *complete* grammar for SmallTalk. I've searched quite
> a bit, but haven't been able to find anything. There doesn't seem to be
> a SmallTalk grammar available. I'd like to create a SmallTalk port to
> another VM. For that, I'd like the grammar in Yacc format, but any other
> would be great, too.

I don't know about a complete grammar for Smalltalk, but the book
Little Smalltalk by Timothy Budd contains syntax diagrams for his
Smalltalk dialect. The book also describes his implementation of
Smalltalk.

You can download the book from this website:

http://www.iam.unibe.ch/~ducasse/FreeBooks.html

It's the third book from the top. The syntax charts are in appendix 2.
Some of the other books might include a complete grammar but I haven't
read any of them.

Merry Christmas,

Peter
From:Trevor Jenkins
Subject:Re: Syntax of SmallTalk
Date:25 Dec 2004 20:17:29 -0500
On 23 Dec 2004 21:36:17 -0500, Klaas-Jan Stol wrote:

> I'm looking for a *complete* grammar for SmallTalk.

Is that even possible?

Been a long time since I used SmallTalk-80 but I seem to recall that
it was possible to introduce ones own syntactical constructs. Or am I
getting confused with POP-11/poplog-11?

> [Somebody asked 10 years ago and got no answers. so don't hold your
breath. > -John]

Presumably the closest we can get is the material in Goldberg et al's
series of books.

Maybe a look at the Squeak interpreter will reveal some helpful stuff.

Regards, Trevor

<>< Re: deemed!
   

Copyright © 2006 knowledge-database   -   All rights reserved