Parglare - A new LR/GLR parser for Python

With this post I’m announcing availability of a new Python parser based on LR(1) and GLR algorithms.

For years I’ve been working with and developing PEG based parsers (see Arpeggio and textX). PEGs have some really nice properties: they represent a concise description of top-down parsers and are easy to understand and debug. Furthermore, with choice operator being ordered PEG grammars can’t be ambiguous. Backtracking is natural and easy to implement giving it unlimited lookahead. A composition of PEG grammars will give a valid PEG grammar, although it might not be what you would expect.

But, there are some drawbacks.


My Spacemacs Odyssey

I’m a long time vim user and I just love vim modal editing approach. But, I always admired Emacs extensibity, introspection and self-documenting capabilities. Although I gave Emacs a try couple of times in the past I just couldn’t get used to non-modal editing and cumbersome finger-stretching keyboard bindings. For some time I was keeping an eye on spacemacs, emacs distribution geared towards vim users. It looked like a perfect blend of vim and emacs so I gave it a try.

Although spacemacs is still beta the switch-over was surprisingly smooth. It took me just a few days to get to the speed thanks to Evil mode, a vim-like modal editing support which is enabled by default in spacemacs. Evil works remarkably good, even some often used plugins are ported like, for example, surround.


Implementing Martin Fowler's State Machine DSL in textX

Well, you know what they say: “You aren’t making a DSL tool if you haven’t implemented Martin Fowler’s State Machine language using your tool yet” ;)

This is a well known DSL example from his book Domain-Specific Languages. If you are doing stuff in the field of DSLs you should definitely read this book. There is an excerpt from the book available on-line so I advise you to read it before watching the video below.


Video introduction to textX

Finally got some time to record first video for textX. In this video I will show you how to install textX and do some first steps. This is my first video tutorial so please bear with me ;)

PsychoPy, Pyo and PulseAudio

Today, while hacking on pyFlies I run into trouble with the code generated for the PsychoPy backend. PsychoPy is using Pyo to generate sound. The problem is that Pyo do not support PulseAudio, only JACK. This might be a good choice since JACK is better suited for low latency sound processing, but today most linux distro use PulseAudio which is better suited for general desktops.

In order to use PsychoPy, first thing to do is to start JACK. Luckily, there are nice GUI apps to do that easily, e.g. QjackCtl or cadence. Starting JACK will suspend PulseAudio while JACK is runnning.

Now, we must instruct pyo called from PsychoPy to use JACK. Although, there is audio parameter in Server call of pyo lib which could be used to specify JACK as the backend, this would require changing source code of PsychoPy. There is luckily a non-obtrusive way to achieve the same effect. Just specify environment variable:

export PYO_SERVER_AUDIO=jack

Now pyo lib will use JACK by default and the PsychoPy sound will work.