On 25/8/14 19:02, Thierry Goubier wrote:
Le 25/08/2014 18:36, Usman Bhatti a écrit :
Tx Thierry. I'd prefer to read and understand the basics of SmaCC first from the Pharo book for intelligent communication :). I'll let you know.

Well, I teach parsing with SmaCC, so I may help :)

Thierry do you have slides and related material?

Stef

Thierry


Usman


On Mon, Aug 25, 2014 at 4:48 PM, Thierry Goubier <thierry.goubier@gmail.com> wrote:



2014-08-25 16:11 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:



It was just a illustrative example to show the slowness of PParser due to the recent modifications. What I want to achieve is to be able to express keyword or lines matching (may be some day complete code blocks as well). We found that doing it with the parser is quite easy.

If there is little context around (deep tree structures, backtracking) then a lexer may be enough. If you give me a bit of context (or a petit parser description), I can work out the equivalent SmaCC grammar.
 

It would be worth trying SmaCC to compare its performance with PP-based solution but I am not knowledgable about SmaCC. Any pointers to where should I start from?

I updated the SmaCC chapter in the PharoForTheEnterprise book; it is also available as help inside Pharo itself.

https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/ws/Smacc/Smacc.pier.pdf 


Thierry
 

regards,

Usman 
 

Keyword [^\n] *

isn't it?

Thierry
 
[|string allStyles  text|
string := (PharoFilesOpener default changesFileOrNil contents copyFrom: 1 to: 60000).
text := string asText.
allStyles := {
'Announcement' -> TextColor green. 
'Collections' -> TextColor blue.
'File' -> TextColor blue.
 'Metacello' -> TextColor red.
'Monticello' -> TextColor magenta.
'Morphic' -> TextColor orange.
'Mooose' -> TextColor green.
'FAMIX' -> TextColor green.
'Roassal' -> TextColor green.
}.
allStyles do: [ :assoc | ((assoc key asParser, #newline asParser negate star) matchingRangesIn: string) do: [:aRange | text addAttribute: (assoc value) from: aRange first to: aRange last] ].
text] timeToRun ==> 15 sec



_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev