Successfully invoking Lua from Squeak using OSProcess Command shell. Also PetitParser? or other?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Successfully invoking Lua from Squeak using OSProcess Command shell. Also PetitParser? or other?

Squeak - Dev mailing list
Thought I would share this,as its pretty cool:

CommandShell command:  'lua -l BananasArgs -e ''p = require("BananasArgs") frame = {} frame["args"] = {"Fred", bananas=5, cherries=2} print(p.has_fruit(frame))'' | inspect; exit'

Where BananasArgs is from Wikimedia https://en.wikipedia.org/wiki/Module:BananasArgs


I am considering writing a Wikitext parser using Squeak.

A prerequisite is that I be able to invoke Lua code "Modules" in wikimedia parlance.  After some poking around, that requirement appears feasable...also, its pretty cool to be able to do that from Squeak. Big smiles (:


So with that proved, I need a Parser to parse Wikitext.

Any recommendations? PetitParser looks pretty cool but I haven't tried to load it into Squeak yet.

Does Squeak Scanner or something else seem viable to you?

Thanks in advance.





Reply | Threaded
Open this post in threaded view
|

Re: Successfully invoking Lua from Squeak using OSProcess Command shell. Also PetitParser? or other?

Levente Uzonyi
On Thu, 25 Jul 2019, gettimothy via Squeak-dev wrote:

> Thought I would share this,as its pretty cool:
>
> CommandShell command:  'lua -l BananasArgs -e ''p = require("BananasArgs") frame = {} frame["args"] = {"Fred", bananas=5, cherries=2} print(p.has_fruit(frame))'' | inspect; exit'
>
> Where BananasArgs is from Wikimedia https://en.wikipedia.org/wiki/Module:BananasArgs
>
>
> I am considering writing a Wikitext parser using Squeak.
>
> A prerequisite is that I be able to invoke Lua code "Modules" in wikimedia parlance.  After some poking around, that requirement appears feasable...also, its pretty cool to be able to do that from Squeak. Big smiles (:
>
>
> So with that proved, I need a Parser to parse Wikitext.
>
> Any recommendations? PetitParser looks pretty cool but I haven't tried to load it into Squeak yet.
In the past few years, I've been using Xtreams-Parsing[1] to generate
parsers. It works even in current Trunk images.

Before that, I remember using MEPS to generate parsers. Back in the day,
it felt easier to use than PetitParser. You can still load it from
SqueakMap, but it needs some changes to work in current Squeaks.

OMeta was great, especially with the tight integration, but I don't
think it works in more recent Squeaks. Never managed to try OMeta2.

And there's of course SmaCC for LR(1) and LALR(1) grammars.
If you happen to have an attribute grammar (I doubt it), I can dig up an
old project, which extends SmaCC to generate a compiler semi-automatically
from your grammar. SmaCC may also not work in recent Squeaks.

>
> Does Squeak Scanner or something else seem viable to you?

Scanner is for tokenizing Smalltalk code. It's not a general purpose
parser generator nor a parser.

Levente

[1] http://squeaksource.com/Xtreams.html

>
> Thanks in advance.
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Successfully invoking Lua from Squeak using OSProcess Command shell. Also PetitParser? or other?

marcel.taeumel
Hi, there.

OMeta was great, especially with the tight integration, but I don't
think it works in more recent Squeaks. Never managed to try OMeta2.

For recent Squeaks, you can try Ohm/S (https://github.com/hpi-swa/Ohm-S) and maybe Gramada (https://github.com/hpi-swa/Gramada).

Best,
Marcel

Am 25.07.2019 22:54:55 schrieb Levente Uzonyi <[hidden email]>:

On Thu, 25 Jul 2019, gettimothy via Squeak-dev wrote:

> Thought I would share this,as its pretty cool:
>
> CommandShell command:  'lua -l BananasArgs -e ''p = require("BananasArgs") frame = {} frame["args"] = {"Fred", bananas=5, cherries=2} print(p.has_fruit(frame))'' | inspect; exit'
>
> Where BananasArgs is from Wikimedia https://en.wikipedia.org/wiki/Module:BananasArgs
>
>
> I am considering writing a Wikitext parser using Squeak.
>
> A prerequisite is that I be able to invoke Lua code "Modules" in wikimedia parlance.  After some poking around, that requirement appears feasable...also, its pretty cool to be able to do that from Squeak. Big smiles (:
>
>
> So with that proved, I need a Parser to parse Wikitext.
>
> Any recommendations? PetitParser looks pretty cool but I haven't tried to load it into Squeak yet.

In the past few years, I've been using Xtreams-Parsing[1] to generate
parsers. It works even in current Trunk images.

Before that, I remember using MEPS to generate parsers. Back in the day,
it felt easier to use than PetitParser. You can still load it from
SqueakMap, but it needs some changes to work in current Squeaks.

OMeta was great, especially with the tight integration, but I don't
think it works in more recent Squeaks. Never managed to try OMeta2.

And there's of course SmaCC for LR(1) and LALR(1) grammars.
If you happen to have an attribute grammar (I doubt it), I can dig up an
old project, which extends SmaCC to generate a compiler semi-automatically
from your grammar. SmaCC may also not work in recent Squeaks.

>
> Does Squeak Scanner or something else seem viable to you?

Scanner is for tokenizing Smalltalk code. It's not a general purpose
parser generator nor a parser.

Levente

[1] http://squeaksource.com/Xtreams.html

>
> Thanks in advance.
>
>
>
>
>