Arpeggio logo

Arpeggio is recursive descent parser with backtracking and memoization (a.k.a. pacrat parser). Arpeggio grammars are based on PEG formalism.

Arpeggio's main use is a foundation for a tool-chain for DSL development but it can be used for all sort of general purpose parsing.

For more information on PEG and packrat parsers see this page.

For a higher level library for building DSLs take a look at textX. It builds on top of Arpeggio and makes language parser implementation a lot easier.

See Getting started in the User Guide menu to get you going or read some of the tutorials.

Features

Python versions

Arpeggio works with Python 2.7, 3.3+. Other versions might work but are not tested.

Open-source projects using Arpeggio

  • textX - Meta-language for building Domain-Specific Languages in Python (and all projects using textX)
  • whatami - Unobtrusive object self-identification for Python (parsers module)
  • ithkuil - A Python package providing tools for analysing texts in the Ithkuil constructed language.

Why is it called arpeggio?

In music, arpeggio is playing the chord notes one by one in sequence. I came up with the name by thinking that parsing is very similar to arpeggios in music. You take tokens one by one from an input and make sense out of it – make a chord!

Well, if you don't buy this maybe it is time to tell you the truth. I searched the dictionary for the words that contain PEG acronym and the word arpeggio was at the top of the list ;)

Citing Arpeggio

If you use Arpeggio please cite this paper:

Dejanović I., Milosavljević G., Vaderna R.: Arpeggio: A flexible PEG parser for Python, Knowledge-Based Systems, 2016, 95, 71 - 74, doi:10.1016/j.knosys.2015.12.004