YAML parser (2017)

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

YAML parser (2017)

Peter Uhnak
Hi,

do we have a working parser for YAML?

There's PPYAMLGrammar (in PetitParser), however it doesn't seem to work in Pharo 6 at all (not even tests pass).
In Pharo 5 the tests are green, but using it on YAML content still fails... with small fix I managed it to "pass", however the output seems to be a very fine-grained AST decomposition and not the expected output (dictionaries/arrays).

So do we have some else/working?

YAML specs have BNF descriptions, so maybe SmaCC can generate it? (I don't know SmaCC, so maybe this is not how it works.)

Thanks,
Peter

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Thierry Goubier
Hi Peter,

If you have a BNF of YAML, then a SmaCC parser with AST generation is at most a day of work. I can help.

Thierry

2017-05-29 9:15 GMT+02:00 Peter Uhnak <[hidden email]>:
Hi,

do we have a working parser for YAML?

There's PPYAMLGrammar (in PetitParser), however it doesn't seem to work in Pharo 6 at all (not even tests pass).
In Pharo 5 the tests are green, but using it on YAML content still fails... with small fix I managed it to "pass", however the output seems to be a very fine-grained AST decomposition and not the expected output (dictionaries/arrays).

So do we have some else/working?

YAML specs have BNF descriptions, so maybe SmaCC can generate it? (I don't know SmaCC, so maybe this is not how it works.)

Thanks,
Peter


Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Hannes Hirzel
In reply to this post by Peter Uhnak
Are there any news about a YAML parser for Pharo 5 / 6.1?

--Hannes

On 5/29/17, Peter Uhnak <[hidden email]> wrote:

> Hi,
>
> do we have a working parser for YAML?
>
> There's PPYAMLGrammar (in PetitParser), however it doesn't seem to work in
> Pharo 6 at all (not even tests pass).
> In Pharo 5 the tests are green, but using it on YAML content still fails...
> with small fix I managed it to "pass", however the output seems to be a very
> fine-grained AST decomposition and not the expected output
> (dictionaries/arrays).
>
> So do we have some else/working?
>
> YAML specs have BNF descriptions, so maybe SmaCC can generate it? (I don't
> know SmaCC, so maybe this is not how it works.)
>
> Thanks,
> Peter
>
>

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Hannes Hirzel
I am not looking for a complete implementation which is quite an effort

but rather for a subset which does simple things such as parsing
- a list of hashes (dictionaries),
- a dictionary of dictionaries (nested to arbitrary depths),
- multi-line comments


--Hannes

On 8/16/17, H. Hirzel <[hidden email]> wrote:

> Are there any news about a YAML parser for Pharo 5 / 6.1?
>
> --Hannes
>
> On 5/29/17, Peter Uhnak <[hidden email]> wrote:
>> Hi,
>>
>> do we have a working parser for YAML?
>>
>> There's PPYAMLGrammar (in PetitParser), however it doesn't seem to work
>> in
>> Pharo 6 at all (not even tests pass).
>> In Pharo 5 the tests are green, but using it on YAML content still
>> fails...
>> with small fix I managed it to "pass", however the output seems to be a
>> very
>> fine-grained AST decomposition and not the expected output
>> (dictionaries/arrays).
>>
>> So do we have some else/working?
>>
>> YAML specs have BNF descriptions, so maybe SmaCC can generate it? (I
>> don't
>> know SmaCC, so maybe this is not how it works.)
>>
>> Thanks,
>> Peter
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Peter Uhnak
Hi,

Phil Back has kindly fixed the PetitYAML so it mostly works now.
The only problem I've encountered was some weird misparsing of strings containing slashes, e.g. "5/".

In any case:

Install PetitParser (from Catalog or somewhere), load PetitYAML package (this is already loaded when loading PP from catalog).

And then parse your string

```
PPYAMLGrammar parse: '
language: c
sudo: false
cache:
  directories:
    - opensmalltalk-vm/.thirdparty-cache
git:
  depth: "5"'.
```


"Dictionary(
        'cache'->a Dictionary(
                'directories'->#('opensmalltalk-vm/.thirdparty-cache')
        )
        'git'->a Dictionary(
                'depth'->'5'
        )
        'language'->'c'
        'sudo'->'false'
)"


Take a look at PPYAMLGrammarTest>>testTravisYml too.

Peter



On Fri, Aug 18, 2017 at 09:45:00AM +0200, H. Hirzel wrote:

> I am not looking for a complete implementation which is quite an effort
>
> but rather for a subset which does simple things such as parsing
> - a list of hashes (dictionaries),
> - a dictionary of dictionaries (nested to arbitrary depths),
> - multi-line comments
>
>
> --Hannes
>
> On 8/16/17, H. Hirzel <[hidden email]> wrote:
> > Are there any news about a YAML parser for Pharo 5 / 6.1?
> >
> > --Hannes
> >
> > On 5/29/17, Peter Uhnak <[hidden email]> wrote:
> >> Hi,
> >>
> >> do we have a working parser for YAML?
> >>
> >> There's PPYAMLGrammar (in PetitParser), however it doesn't seem to work
> >> in
> >> Pharo 6 at all (not even tests pass).
> >> In Pharo 5 the tests are green, but using it on YAML content still
> >> fails...
> >> with small fix I managed it to "pass", however the output seems to be a
> >> very
> >> fine-grained AST decomposition and not the expected output
> >> (dictionaries/arrays).
> >>
> >> So do we have some else/working?
> >>
> >> YAML specs have BNF descriptions, so maybe SmaCC can generate it? (I
> >> don't
> >> know SmaCC, so maybe this is not how it works.)
> >>
> >> Thanks,
> >> Peter
> >>
> >>
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Hannes Hirzel
Hello Peter

Thank you for the answer. Good news that Phil Back has an done
upgraded version of the PetitYAML parser recently.

I think what you describe as "mostly complete" will be very fine for
my purposes.

On 8/18/17, Peter Uhnak <[hidden email]> wrote:

> Hi,
>
> Phil Back has kindly fixed the PetitYAML so it mostly works now.
> The only problem I've encountered was some weird misparsing of strings
> containing slashes, e.g. "5/".
>
> In any case:
>
> Install PetitParser (from Catalog or somewhere), load PetitYAML package
> (this is already loaded when loading PP from catalog).

I just installed Pillar and that pulled in PetitParser. Not sure if it
is a good idea now to re-install PetitParser again.

In particular there is only PetitParser catalog entry for Pharo 5.0,
not 6.0 or 6.1

I assume that can directly load the PetitYAML from the repository instead.
Where do I find it?


> And then parse your string
>
> ```
> PPYAMLGrammar parse: '
> language: c
> sudo: false
> cache:
>   directories:
>     - opensmalltalk-vm/.thirdparty-cache
> git:
>   depth: "5"'.
> ```
>
>
> "Dictionary(
> 'cache'->a Dictionary(
> 'directories'->#('opensmalltalk-vm/.thirdparty-cache')
> )
> 'git'->a Dictionary(
> 'depth'->'5'
> )
> 'language'->'c'
> 'sudo'->'false'
> )"
>

Thank you for the example.

> Take a look at PPYAMLGrammarTest>>testTravisYml too.
>
> Peter
>

--Hannes

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Peter Uhnak
On Fri, Aug 18, 2017 at 09:50:35PM +0200, H. Hirzel wrote:

> Hello Peter
>
> Thank you for the answer. Good news that Phil Back has an done
> upgraded version of the PetitYAML parser recently.
>
> I think what you describe as "mostly complete" will be very fine for
> my purposes.
>
> On 8/18/17, Peter Uhnak <[hidden email]> wrote:
> > Hi,
> >
> > Phil Back has kindly fixed the PetitYAML so it mostly works now.
> > The only problem I've encountered was some weird misparsing of strings
> > containing slashes, e.g. "5/".
> >
> > In any case:
> >
> > Install PetitParser (from Catalog or somewhere), load PetitYAML package
> > (this is already loaded when loading PP from catalog).
>
> I just installed Pillar and that pulled in PetitParser. Not sure if it
> is a good idea now to re-install PetitParser again.
>
> In particular there is only PetitParser catalog entry for Pharo 5.0,
> not 6.0 or 6.1

I don't know about this, you'd have to ask the Moose team (or whoever is responsible for PetitParser now)

>
> I assume that can directly load the PetitYAML from the repository instead.
> Where do I find it?

Open Monticello Browser, find PetitParser repository and open it, select PetitYAML package, select the latest version, right click and load.

Peter

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Hannes Hirzel
Hello again

On 8/18/17, Peter Uhnak <[hidden email]> wrote:
[...]
>> I assume that can directly load the PetitYAML from the repository
>> instead.
>> Where do I find it?
>
> Open Monticello Browser, find PetitParser repository and open it, select
> PetitYAML package, select the latest version, right click and load.
>
> Peter
>
Thank you for the instructions.
Loading PetitYAML-PhilippeBack.11.mcz went fine.

But out of 76 tests I get 57 errors. This are so many error that that
it is quite possible that they have a single cause. I did not start
debugging.

Something similar happens if I go back to
PetitYAML-JanKurs.8
Author: JanKurs
Time: 15 June 2016

What I aiming at is

- to have Pillar loaded (was successful, see other thread)
- get a working PetitYAML version

--Hannes

P.S. Note that the screen shot shows a Pharo 6.0 version. But it
actually is 6.1 (see other thread).

Loading PetitYAML-Pharo 6.1_PhilippeBack_Screenshot from 2017-08-18.png (294K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Peter Uhnak
All my tests are green, so maybe you need to update PetitParser too to the latest (PetitParser-JanKurs.290)

It is probable that Pillar loaded older version of PetitParser.

Peter


On Fri, Aug 18, 2017 at 10:56:30PM +0200, H. Hirzel wrote:

> Hello again
>
> On 8/18/17, Peter Uhnak <[hidden email]> wrote:
> [...]
> >> I assume that can directly load the PetitYAML from the repository
> >> instead.
> >> Where do I find it?
> >
> > Open Monticello Browser, find PetitParser repository and open it, select
> > PetitYAML package, select the latest version, right click and load.
> >
> > Peter
> >
> Thank you for the instructions.
> Loading PetitYAML-PhilippeBack.11.mcz went fine.
>
> But out of 76 tests I get 57 errors. This are so many error that that
> it is quite possible that they have a single cause. I did not start
> debugging.
>
> Something similar happens if I go back to
> PetitYAML-JanKurs.8
> Author: JanKurs
> Time: 15 June 2016
>
> What I aiming at is
>
> - to have Pillar loaded (was successful, see other thread)
> - get a working PetitYAML version
>
> --Hannes
>
> P.S. Note that the screen shot shows a Pharo 6.0 version. But it
> actually is 6.1 (see other thread).



Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Hannes Hirzel
Peter, thanks for the confirmation that in your installation of the
PetitYAML grammar all tests are green.

I wonder how you did it.

This is what I did:

1. I put Pillar on the back burner for the moment and

2. I went for a pristine Pharo 6.0 Latest update: #60510 image (a.k.a. 6.1).

3. Then I installed PetitParser only through the catalog --
    the entry is still tagged for Pharo 5.0

4. Then I added PetitYAML

    Name: PetitYAML-PhilippeBack.11
    Author: PhilippeBack
    Time: 29 May 2017, 12:53:55.994195 pm
    UUID: d7658233-112c-754c-81a7-d60139bb9549

    taken from

    MCSmalltalkhubRepository
    owner: 'Moose'
        project: 'PetitParser'
        user: ''
        password: ''


5. Running the tests gave me

    76 run -- 76 errors


What am I missing here?

Is there an easy workaround to get PetitParser with PetitYAML into
6.0-#60510 (a.k.a. 6.1) ?

--Hannes

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Hannes Hirzel
P.S. I assume I need to get a developer version. How do I do that?

On 8/19/17, H. Hirzel <[hidden email]> wrote:

> Peter, thanks for the confirmation that in your installation of the
> PetitYAML grammar all tests are green.
>
> I wonder how you did it.
>
> This is what I did:
>
> 1. I put Pillar on the back burner for the moment and
>
> 2. I went for a pristine Pharo 6.0 Latest update: #60510 image (a.k.a.
> 6.1).
>
> 3. Then I installed PetitParser only through the catalog --
>     the entry is still tagged for Pharo 5.0
>
> 4. Then I added PetitYAML
>
>     Name: PetitYAML-PhilippeBack.11
>     Author: PhilippeBack
>     Time: 29 May 2017, 12:53:55.994195 pm
>     UUID: d7658233-112c-754c-81a7-d60139bb9549
>
>     taken from
>
>     MCSmalltalkhubRepository
>     owner: 'Moose'
> project: 'PetitParser'
> user: ''
> password: ''
>
>
> 5. Running the tests gave me
>
>     76 run -- 76 errors
>
>
> What am I missing here?
>
> Is there an easy workaround to get PetitParser with PetitYAML into
> 6.0-#60510 (a.k.a. 6.1) ?
>
> --Hannes
>

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Peter Uhnak
In reply to this post by Hannes Hirzel
On Sat, Aug 19, 2017 at 02:45:28PM +0200, H. Hirzel wrote:
> Peter, thanks for the confirmation that in your installation of the
> PetitYAML grammar all tests are green.
>
> I wonder how you did it.

As I've said, you need to update PetitParser; if there's no appropriate catalog entry, then ConfigurationOfPetitParser loadBleeding edge, or manually via Monticello Browser (the same way you loaded PetitYAML).

Peter

>
> This is what I did:
>
> 1. I put Pillar on the back burner for the moment and
>
> 2. I went for a pristine Pharo 6.0 Latest update: #60510 image (a.k.a. 6.1).
>
> 3. Then I installed PetitParser only through the catalog --
>     the entry is still tagged for Pharo 5.0
>
> 4. Then I added PetitYAML
>
>     Name: PetitYAML-PhilippeBack.11
>     Author: PhilippeBack
>     Time: 29 May 2017, 12:53:55.994195 pm
>     UUID: d7658233-112c-754c-81a7-d60139bb9549
>
>     taken from
>
>     MCSmalltalkhubRepository
>     owner: 'Moose'
> project: 'PetitParser'
> user: ''
> password: ''
>
>
> 5. Running the tests gave me
>
>     76 run -- 76 errors
>
>
> What am I missing here?
>
> Is there an easy workaround to get PetitParser with PetitYAML into
> 6.0-#60510 (a.k.a. 6.1) ?
>
> --Hannes

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Hannes Hirzel
On 8/19/17, Peter Uhnak <[hidden email]> wrote:

> On Sat, Aug 19, 2017 at 02:45:28PM +0200, H. Hirzel wrote:
>> Peter, thanks for the confirmation that in your installation of the
>> PetitYAML grammar all tests are green.
>>
>> I wonder how you did it.
>
> As I've said, you need to update PetitParser; if there's no appropriate
> catalog entry, then ConfigurationOfPetitParser loadBleeding edge, or
> manually via Monticello Browser (the same way you loaded PetitYAML).
>
> Peter
Thanks, loading ConfigurationOfPetitParser-TudorGirba.80 through the
Monticello Browser (not the catalog) into Pharo 6 and then

   ConfigurationOfPetitParser load

did the job. Now all PetitYAML grammar tests are grenen.

--Hannes

PetitYAML_in_Pharo_6.0_2017-08-19.png (85K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Stephane Ducasse-3
Hi Hannes

you should report this to doru.

Stef

On Sat, Aug 19, 2017 at 8:36 PM, H. Hirzel <[hidden email]> wrote:

> On 8/19/17, Peter Uhnak <[hidden email]> wrote:
>> On Sat, Aug 19, 2017 at 02:45:28PM +0200, H. Hirzel wrote:
>>> Peter, thanks for the confirmation that in your installation of the
>>> PetitYAML grammar all tests are green.
>>>
>>> I wonder how you did it.
>>
>> As I've said, you need to update PetitParser; if there's no appropriate
>> catalog entry, then ConfigurationOfPetitParser loadBleeding edge, or
>> manually via Monticello Browser (the same way you loaded PetitYAML).
>>
>> Peter
>
> Thanks, loading ConfigurationOfPetitParser-TudorGirba.80 through the
> Monticello Browser (not the catalog) into Pharo 6 and then
>
>    ConfigurationOfPetitParser load
>
> did the job. Now all PetitYAML grammar tests are grenen.
>
> --Hannes

Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Hannes Hirzel
Reported to Doru and he answered that they will come up with a release
of PetitParser for 6.0/6.1.

The installation script to use in the meantime is:

Metacello new
      smalltalkhubUser: 'Moose' project: 'PetitParser';
      configuration: 'PetitParser';
      version: #development;
      load.
Gofer new
      smalltalkhubUser: 'Moose' project: 'PetitParser';
      package: 'PetitYAML';
      load.


308 tests out of 308 tests are green (see screen shot).


--Hannes



On 8/22/17, Stephane Ducasse <[hidden email]> wrote:

> Hi Hannes
>
> you should report this to doru.
>
> Stef
>
> On Sat, Aug 19, 2017 at 8:36 PM, H. Hirzel <[hidden email]> wrote:
>> On 8/19/17, Peter Uhnak <[hidden email]> wrote:
>>> On Sat, Aug 19, 2017 at 02:45:28PM +0200, H. Hirzel wrote:
>>>> Peter, thanks for the confirmation that in your installation of the
>>>> PetitYAML grammar all tests are green.
>>>>
>>>> I wonder how you did it.
>>>
>>> As I've said, you need to update PetitParser; if there's no appropriate
>>> catalog entry, then ConfigurationOfPetitParser loadBleeding edge, or
>>> manually via Monticello Browser (the same way you loaded PetitYAML).
>>>
>>> Peter
>>
>> Thanks, loading ConfigurationOfPetitParser-TudorGirba.80 through the
>> Monticello Browser (not the catalog) into Pharo 6 and then
>>
>>    ConfigurationOfPetitParser load
>>
>> did the job. Now all PetitYAML grammar tests are grenen.
>>
>> --Hannes
>
>

Pharo6.1_plus_PetitParser_plus_PetitYAML_installation_test_Screenshot_2017-08-24.png (165K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: YAML parser (2017)

Stephane Ducasse-3
I love such green tests.


On Thu, Aug 24, 2017 at 1:48 PM, H. Hirzel <[hidden email]> wrote:

> Reported to Doru and he answered that they will come up with a release
> of PetitParser for 6.0/6.1.
>
> The installation script to use in the meantime is:
>
> Metacello new
>       smalltalkhubUser: 'Moose' project: 'PetitParser';
>       configuration: 'PetitParser';
>       version: #development;
>       load.
> Gofer new
>       smalltalkhubUser: 'Moose' project: 'PetitParser';
>       package: 'PetitYAML';
>       load.
>
>
> 308 tests out of 308 tests are green (see screen shot).
>
>
> --Hannes
>
>
>
> On 8/22/17, Stephane Ducasse <[hidden email]> wrote:
>> Hi Hannes
>>
>> you should report this to doru.
>>
>> Stef
>>
>> On Sat, Aug 19, 2017 at 8:36 PM, H. Hirzel <[hidden email]> wrote:
>>> On 8/19/17, Peter Uhnak <[hidden email]> wrote:
>>>> On Sat, Aug 19, 2017 at 02:45:28PM +0200, H. Hirzel wrote:
>>>>> Peter, thanks for the confirmation that in your installation of the
>>>>> PetitYAML grammar all tests are green.
>>>>>
>>>>> I wonder how you did it.
>>>>
>>>> As I've said, you need to update PetitParser; if there's no appropriate
>>>> catalog entry, then ConfigurationOfPetitParser loadBleeding edge, or
>>>> manually via Monticello Browser (the same way you loaded PetitYAML).
>>>>
>>>> Peter
>>>
>>> Thanks, loading ConfigurationOfPetitParser-TudorGirba.80 through the
>>> Monticello Browser (not the catalog) into Pharo 6 and then
>>>
>>>    ConfigurationOfPetitParser load
>>>
>>> did the job. Now all PetitYAML grammar tests are grenen.
>>>
>>> --Hannes
>>
>>