Newspeak parser implemented in Smalltalk

77 views
Skip to first unread message

Wouter Gazendam

unread,
May 13, 2015, 8:33:52 AM5/13/15
to newspeak...@googlegroups.com
Is there a Newspeak parser around implemented in Smalltalk? I can imagine one was written to bootstrap Newspeak development but I only can find one implemented in Newspeak itself.

Thanks,

Wouter 

Gilad Bracha

unread,
May 13, 2015, 10:36:34 AM5/13/15
to newspeak...@googlegroups.com
Indeed, there was one written to bootstrap the system. More precisely, the first version of the parser combinator library was written in Smalltalk, and used to parse the first dialect of Newspeak, NS0.  Since then the syntax and semantics evolved thru NS1, NS2 and NS3 (which itself changed gradually, so it's kind of NS4). 

In short, there never was a Smalltalk parser for full Newspeak, with nested classes etc. As for the Smalltalk version of the parser combinator library, it too is long gone. It had ceased to be by the time of the first open source release, so I doubt it was ever made public.

Why do you ask?

Wouter Gazendam

unread,
May 13, 2015, 12:01:50 PM5/13/15
to newspeak...@googlegroups.com
I have a MDE environment in VisualWorks in which the model definitions (which are in a sort of DSL) are currently transformed to Smalltalk classes. For the next version of the modeling language I'd like to use something like Newspeak instead of the DSL but I need a way to get my current model definitions transformed to Newspeak and back.

O well, handcrafing a parser shouldnt be that much work. Newspeak's grammar seems to be comparable in complexity to Smalltalk.

W

Eliot Miranda

unread,
May 13, 2015, 12:07:49 PM5/13/15
to newspeak...@googlegroups.com
Hi Wouter,

On Wed, May 13, 2015 at 9:01 AM, Wouter Gazendam <wou...@ag5.nl> wrote:
I have a MDE environment in VisualWorks in which the model definitions (which are in a sort of DSL) are currently transformed to Smalltalk classes. For the next version of the modeling language I'd like to use something like Newspeak instead of the DSL but I need a way to get my current model definitions transformed to Newspeak and back.

O well, handcrafing a parser shouldnt be that much work. Newspeak's grammar seems to be comparable in complexity to Smalltalk.

Instead of doing that you could mechanically transform the current Newspeak syntax into a Smalltalk version that is similar to the old Squeak ParserCombinator framework.

I *think* I have an example of that old framework lying around somewhere but surely you could find it in an old Newspeak release via the wayback machine.
 


W
 
On Wednesday, May 13, 2015 at 4:36:34 PM UTC+2, Gilad Bracha wrote:
Indeed, there was one written to bootstrap the system. More precisely, the first version of the parser combinator library was written in Smalltalk, and used to parse the first dialect of Newspeak, NS0.  Since then the syntax and semantics evolved thru NS1, NS2 and NS3 (which itself changed gradually, so it's kind of NS4). 

In short, there never was a Smalltalk parser for full Newspeak, with nested classes etc. As for the Smalltalk version of the parser combinator library, it too is long gone. It had ceased to be by the time of the first open source release, so I doubt it was ever made public.

Why do you ask?

On Wed, May 13, 2015 at 5:33 AM Wouter Gazendam <wou...@ag5.nl> wrote:
Is there a Newspeak parser around implemented in Smalltalk? I can imagine one was written to bootstrap Newspeak development but I only can find one implemented in Newspeak itself.

Thanks,

Wouter 



--
best,
Eliot

Gilad Bracha

unread,
May 13, 2015, 1:55:18 PM5/13/15
to newspeak...@googlegroups.com
I doubt if it ever was in a release
But if it's useful we can check

Vassili Bykov

unread,
May 13, 2015, 2:34:39 PM5/13/15
to newspeak...@googlegroups.com
I have a few proto-Newspeak images from February 2007 still sitting in my home directory, but I don't have a VM to run them.

Gilad Bracha

unread,
May 13, 2015, 3:42:02 PM5/13/15
to newspeak...@googlegroups.com
I discussed this with Ryan.  Mt thought is that the easiest thing to do would be to recover the Smalltalk version of parser combinators and port the current grammar back to it. We might have the old combinator library somewhere - it might even have been in a release. We'll see if we can dig it up.

Of course, you'd still need to write the semantic actions, which is more work,  And I'm still unclear about the overall application. 

Wouter Gazendam

unread,
May 14, 2015, 4:25:57 AM5/14/15
to newspeak...@googlegroups.com
Other wild idea. How hard would it be for me to get newspeak running on the visualworks vm?
--
Wouter Gazendam
AG5 B.V.
Oostelijke Handelskade 865
1019 BW Amsterdam
http://www.ag5.nl
Tel: 020-4630942
Fax: 020-4630946

Ryan Macnak

unread,
May 14, 2015, 11:47:26 AM5/14/15
to newspeak...@googlegroups.com

A lot of work. Just to run hello world, you would need to implement Newspeak's lookup rules in terms of HPS's bytecodes, write some object tracer to convert Behaviors, MethodDictionaries, etc in the bootstrap runtime to their VW counterparts, etc.

It would perform slower than on Cog. And most application code would be easier to port from VW Smalltalk code to Squeak Smalltalk or Newspeak.

Wouter Gazendam

unread,
May 15, 2015, 9:09:38 AM5/15/15
to newspeak...@googlegroups.com
I've backported the CombinatorialParsing framework from Newspeak to VisualWorks and am currently able to parse all of newspeak_bleeding_edge.
Next I'm going to use the tokenized output of NewspeakASTs.ns3 to recreate the AST classes in my image.

Thanks for all the help so far.

Wouter

Gilad Bracha

unread,
May 15, 2015, 10:03:09 AM5/15/15
to newspeak...@googlegroups.com
Nice. 
Reply all
Reply to author
Forward
0 new messages