Skip to content

Instantly share code, notes, and snippets.

View magcius's full-sized avatar
🐬
it's a dAmN cOld NiGhT tryin 2 figure out this life

Jasper St. Pierre magcius

🐬
it's a dAmN cOld NiGhT tryin 2 figure out this life
View GitHub Profile
@magcius
magcius / tutorial.rst
Created August 20, 2012 03:25 — forked from washort/tutorial.rst
parsley tutorial

Parsley Tutorial

From Regular Expressions To Grammars

Parsley is a pattern matching and parsing tool for Python programmers.

@magcius
magcius / tutorial.rst
Created August 14, 2012 04:36 — forked from washort/tutorial.rst
parsley docs

Parsley Tutorial

Let's parse it up with Parsley. Following the standard example of other parsing frameworks, we're going to build a standard mathematical expression parser. Unlike other frameworks like PyParsing, Parsley grammars are defined in a giant string, rather than a special DSL.

Let's start with something that can interpret a collection of digits, and spit out a number:

import parsley
#include <sdl.h>
struct _EventFuncs {
void (*on_keydown) (char key, void *user_data);
void (*on_loop) (void *user_data);
};
typedef struct _EventFuncs EventFucs;
void event_loop(EventFuncs *event_funcs, void *user_data) {
@magcius
magcius / array_v.h
Created September 23, 2011 02:44 — forked from rosonowski/array_v.h
// FileName : array_v.h
// programmer bj streller and general folklore
// PURPOSE : Provides an extended definition of an Array ADT.
// We assume IndexType is a finite collection of consecutively
// enumerated values such as integers, characters, or enum values,
// and that BaseData is any type.
// Bounds checking via the assert macro is also done.