[Pharo-users] what to use for simple parsing

2015-03-27 Thread Peter Uhnák
Hi, I would like to parse text like - id(param1, param2, ... paramX) id -> id id ->> id - id is alphanumeric string, param is any string optionally enclosed in quotes (so both quoted and unquoted string is needed) I saw that there are many tools for parsing but since I have no experience

Re: [Pharo-users] what to use for simple parsing

2015-03-28 Thread Thierry Goubier
Hi Peter, I can answer for SmaCC. It would do the job, be very simple and fairly fast with a trick or two to handle the param unquoted string. Thierry Le 28/03/2015 02:53, Peter Uhnák a écrit : Hi, I would like to parse text like - id(param1, param2, ... paramX) id -> id id ->> id -

Re: [Pharo-users] what to use for simple parsing

2015-03-28 Thread Martin Bähr
Excerpts from Thierry Goubier's message of 2015-03-28 08:46:46 +0100: > I can answer for SmaCC. It would do the job, be very simple and fairly > fast with a trick or two to handle the param unquoted string. could someone provide (or link to) a comparison between the major parsers? why are there e

Re: [Pharo-users] what to use for simple parsing

2015-03-28 Thread kilon alios
PettitParser provides a more Pharo orientated syntax. SmaCC uses syntax very similar to regex. SmaCC comes with a lot of parser for programming languages. I chose SmaCC because a) the syntax is very compact and it allows me a bird's eye view over the overall syntax definition, but also more diffi

Re: [Pharo-users] what to use for simple parsing

2015-03-28 Thread stepharo
In essence you have - PetitParser (read chapter in deep into pharo) incremental composable flexible a bit slow - Smacc static traditional I think that there is one chapter in book in progress on github Stef Excerp

Re: [Pharo-users] what to use for simple parsing

2015-03-31 Thread Damien Cassou
Peter Uhnák writes: > Hi, > > I would like to parse text like > - > id(param1, param2, ... paramX) > id -> id > id ->> id > - > id is alphanumeric string, > param is any string optionally enclosed in quotes (so both quoted and > unquoted string is needed) I would start with streams and

Re: [Pharo-users] what to use for simple parsing

2015-03-31 Thread Peter Uhnák
Thanks all, in the end I've used PetitParser and I was really surprised and happy how easy and far I've got with it. TBH using regular expressions in Pharo feels extremely uncomfortable to me compared to Perl or Ruby, but maybe that was design decision by the author to not be too hacky. So at le

Re: [Pharo-users] what to use for simple parsing

2015-03-31 Thread Tudor Girba
Not to mention that you can also read it :) Doru On Tue, Mar 31, 2015 at 5:17 PM, Peter Uhnák wrote: > Thanks all, > > in the end I've used PetitParser and I was really surprised and happy how > easy and far I've got with it. > > TBH using regular expressions in Pharo feels extremely uncomforta

Re: [Pharo-users] what to use for simple parsing

2015-04-01 Thread stepharo
Le 31/3/15 17:17, Peter Uhnák a écrit : Thanks all, in the end I've used PetitParser and I was really surprised and happy how easy and far I've got with it. TBH using regular expressions in Pharo feels extremely uncomfortable to me compared to Perl or Ruby, but maybe that was design decisi

Re: [Pharo-users] what to use for simple parsing

2015-04-01 Thread Martin Bähr
Excerpts from stepharo's message of 2015-04-01 23:00:11 +0200: > May be this was a mistake to get regexp. Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (jwz)

Re: [Pharo-users] what to use for simple parsing

2015-04-02 Thread kilon alios
depends on your needs. I never used regex before , pharo regex was my first. I used on a specific case that was quite simple. I love its simplicity and its extremely compact syntax. Perfect fit for my needs, one very happy customer :) I think it depends on complexity of the parsing and how you lik

Re: [Pharo-users] what to use for simple parsing

2015-04-02 Thread p...@highoctane.be
On Thu, Apr 2, 2015 at 9:45 AM, kilon alios wrote: > depends on your needs. I never used regex before , pharo regex was my > first. I used on a specific case that was quite simple. I love its > simplicity and its extremely compact syntax. Perfect fit for my needs, one > very happy customer :) > >

Re: [Pharo-users] what to use for simple parsing

2015-04-02 Thread Damien Pollet
On 31 March 2015 at 17:17, Peter Uhnák wrote: > So at least to me PetitParser feels like a more practical regex library > than Regex itself. In which use-cases is Regex less practical? I'm thinking it could get a builder with a PetitParser-like API in addition to the current string syntax.

Re: [Pharo-users] what to use for simple parsing

2015-04-02 Thread kilon alios
"I used Regex at first to do the job but it turned into an unholy mess (not that it couldn't parse what I needed) and PetitParser was there." it really depends how you approach this. For example in my case I quickly found out that would be insane to put everything in a single string, so I broke t

Re: [Pharo-users] what to use for simple parsing

2015-04-02 Thread p...@highoctane.be
Sure works. Regex '((XXX Logical Channel) ([0-9])) on (((Upstream)|(Downstream)) ([0-9])) on ((chassis) ([0-9])), ((slot) ([0-9])), ((mac) ([0-9]))' asRegex But in PP, things were more comple and there were a lot of them, so: line ^ temperatureStatusDescrEntry token asParser / temperatureStatus

Re: [Pharo-users] what to use for simple parsing

2015-04-02 Thread kilon alios
yeap you use what makes your life easier ;) On Thu, Apr 2, 2015 at 12:49 PM, p...@highoctane.be wrote: > Sure works. > > Regex > > '((XXX Logical Channel) ([0-9])) on (((Upstream)|(Downstream)) ([0-9])) on > ((chassis) ([0-9])), ((slot) ([0-9])), ((mac) ([0-9]))' asRegex > > But in PP, things we

Re: [Pharo-users] what to use for simple parsing

2015-04-02 Thread Thierry Goubier
2015-04-02 11:49 GMT+02:00 p...@highoctane.be : > Sure works. > > Regex > > '((XXX Logical Channel) ([0-9])) on (((Upstream)|(Downstream)) ([0-9])) on > ((chassis) ([0-9])), ((slot) ([0-9])), ((mac) ([0-9]))' asRegex > > But in PP, things were more comple and there were a lot of them, so: > > line