Author Archives: kay

Pattern matching with TupleTrees

As it seems advanced dispatch schemes are discussed right now under the pattern matching label. In this article I want to discuss another solution using a data-structure called the `TupleTree` ( also known as prefix tree or trie ). The … Continue reading

Posted in Python | Comments Off on Pattern matching with TupleTrees

Trace Based Parsing (Part V) – From Grammars to NFAs

In this article I will demonstrate the translation process by which an EBNF grammar will be translated into a Trail NFA. There are several different notations for EBNF that differ only in minor details. I’ve chosen the one of Pythons … Continue reading

Posted in EasyExtend, Grammars, TBP | Comments Off on Trace Based Parsing (Part V) – From Grammars to NFAs

Trace Based Parsing ( Part IV ) – Recursive NFAs

Not long ago I inserted the following piece of code in the `EasyExtend/trail/nfatracing.py` module which defines NFA tracers and cursors and deals with the reconstruction of parse trees from state set sequences. class NFAInterpreter(object): def __init__(self, nfa): for state in … Continue reading

Posted in EasyExtend, Grammars, TBP | Comments Off on Trace Based Parsing ( Part IV ) – Recursive NFAs

Trace Based Parsing ( Part III ) – NFALexer

The NFALexer gives me an uneasy feeling. It is the most questionable of Trails components – one that cannot decide whether it wants to be a lexer that produces a token stream or a parser that produces parse trees. Continue reading

Posted in EasyExtend, Grammars, TBP | Comments Off on Trace Based Parsing ( Part III ) – NFALexer

Trace Based Parsing ( Part II ) – NFA Expansion

In the previous article about trace based parsing (TBP) I explained the basic concepts of TBP. I motivated TBP by parse tree validators that check the correctness of parse trees against grammars and I derived a trace based LL(1) parser. … Continue reading

Posted in EasyExtend, Grammars | Comments Off on Trace Based Parsing ( Part II ) – NFA Expansion

Trace Based Parsing (Part I) – Introduction

This is the first in a series of articles about Trace Based Parsing ( TBP ). Trace based parsing is a powerful top down, table driven parsing style. TBP is the technique underlying Trail which is the parser generator of … Continue reading

Posted in EasyExtend, Grammars | Comments Off on Trace Based Parsing (Part I) – Introduction

Python vs TTCN-3

Some time ago computing scientists Bernard Stepien and Liam Peyton from the University of Ottawa compared Python with TTCN-3. TTCN-3 means Testing and Test Control Notation and it is domain specific language specifically designed for writing tests in the domain … Continue reading

Posted in DSL, Python, Testing | 4 Comments

Tail recursion decorator revisited

A while ago some of us tried to find the best solution for a tail recursion decorator. The story began when Crutcher Dunnavant came up with a surprising decorator that was able to eliminate tail recursion. His solution used stack … Continue reading

Posted in Python | 6 Comments

Universal Set in Python

Building sets from set() and ANY When defining a regular expression there is a well known duality between a set of characters specified by enclosing characters or character ranges within square brackets `[…]` and defining the pattern of the complement … Continue reading

Posted in Mathematics, Python | Tagged | 5 Comments

The statement that never was

The Python release archive is a nice repository for archaeological findings. My biggest surprise was the existence of an access statement and `access` keyword in the pre-history of Python 1.5.0. The syntax was already specified in release 1.0 with an … Continue reading

Posted in General, Python | Tagged | 1 Comment