Happy !

JanKurs / PetitParser

Project infos

License MIT
Tags
Creation date 2013-04-06
Website

Monticello registration

About PetitParser

PetitCompiler

We have a wiki page with some basic information.

Loading Parser Compiler

For Users:

Gofer new smalltalkhubUser: 'JanKurs' project: 'PetitParser';
    configurationOf: #PetitCompiler; load.
(Smalltalk at: #ConfigurationOfPetitCompiler) perform: #'loadStable'.

For Developers:

"Needed only when using Moose 5.1"
(Smalltalk at: #ConfigurationOfPetitParser) perform: #'loadDevelopment'.

Gofer new smalltalkhubUser: 'JanKurs' project: 'PetitParser';
    configurationOf: #PetitCompiler; load.
(Smalltalk at: #ConfigurationOfPetitCompiler) perform: #'loadDevelopment'.

Please note, it is essential to call class-side method loadDevelopment of Configuration in order to obtain the properly loaded version.

Loading Petit Markdown

Gofer new
    url: 'http://smalltalkhub.com/mc/JanKurs/PetitParser/main';
    package: 'PetitMarkdown';
    load.

How to Load Petit Parser

My suggestion is to use Moose for the best experience with PetitParser.

If you don't want to use Moose, go to the Pharo.org and download the latest image. Than execute this in your workspace:

Gofer new smalltalkhubUser: 'Moose' project: 'PetitParser';
    configurationOf: #PetitParser; load.
(Smalltalk at: #ConfigurationOfPetitParser) perform: #loadDevelopment.

Ruby Parser

What is RubyParser

RubyParser is semi-parser of ruby utilizing islands, indentation and compiler in order to recognize following elements in the ruby source files:

  • classes
  • modules
  • methods
  • method calls

The grammar is minimalistic, implementing only elements mentioned above + some minor stuff such as simplified comments and strings.

What is it good for?

This parser can be (eventually) used to build moose models for preliminary analysis of Ruby programs.

How precise is it?

We tested on 5 popular ruby projects, with precision 0.99 and recall 0.98. The structural elements (classes, modules and methods) are without errors, there is 1% of errors in the method calls.

How fast is it?

Using the compiler, reasonably fast (for run once in a time purposes). We analyzed 5 ruby projects from github in cca 10minutes, parsing three tousands of files.