Welcome to MetaSyntax.py

Introduction

MetaSyntax.py is a simple approach to a lightweight, pythonic metasyntactical notation Normally when working with parser generators, one will end up using BNF or some variation of that. I wanted to try developing a simple, more pythonic notation to define grammars.

Principles

Whereas in tradition metasyntactical notations like BNF, EBNF or some flavours of those, you specify a grammar in text, which will then be parsed by a parser generator to create a parser.

This grammar consist of rules, which regularly consist of grouping logical or text rules or regular expressions together, which the generated parser will then try to match with input text.

In MetaSyntax.py Rules are python objects consisting of string token objects, regular expression objects and logical token objects, which make up a grammar object. Of course, this object has no need to be parsed and is thus easier to use.

MetaSyntax.py grammars are pure Python and very lightweight.

MetaSyntax.py has no dependencies. In fact, it only imports the re module and nothing else