Programs must be written for people to read, and only incidentally for machines to execute. — Abelson & Sussman, Structure and Interpretation of Computer ProgramsCode readability gets talked about a lot these days. I haven't yet heard from anyone who's opposed to it. Unfortunately, learning to read code is a skill rarely discussed and even more rarely...
I've just upload the initial release of a Python implementation of Alessandro Warth's OMeta, an object-oriented pattern matching language. Get the tarball here (or simply bzr get lp:pymeta). It's an extremely handy tool for all kinds of parsing and filtering jobs. Here's a tiny example: >>> exampleGrammar = """ word ::= <letter>+:chars...
(Note: In the course of writing this post, I fixed a bug. Get PyMeta 0.1.1 here.) Python already has a big pile of parsing frameworks, such as ANTLR, PLY, PyParsing, YAPPS2, ZAPPS, ZestyParser, and plenty others. Why did I write another one? PyMeta Works Like Python One of the main difficulties I've had using parser generators has been the difficulty...
PyMeta is more than just a parsing framework, it's a general pattern matching language. Here's a parser for a tiny HTML-like language: from pymeta.grammar import OMeta from itertools import chain tinyHTMLGrammar = """ name ::= <letterOrDigit>+:ls => ''.join(ls) tag ::= ('<' <spaces> <name>:n <spaces> <attribute>*:attrs...
Originally when I was implementing PyMeta I was sure that the input stream implementation that the Javascript version used was inefficient. Rather than having a mutable object with methods for advancing and rewinding the stream, it has immutable objects with "head" and "tail" methods, which return the value at the current position and a new object representing...
I'm happy to announce Ecru, a new implementation of the E language. E is a language designed both for security and safe and efficient concurrency. Twisted borrowed the idea of Deferreds from E, where they are much better integrated into the language than in Python, owing to the syntax and library support E provides. E's design is based around capability...
Build your own newsfeed
Ready to give it a go?
Start a 14-day trial, no credit card required.