Skip to content

Instantly share code, notes, and snippets.

View PatrikValkovic's full-sized avatar

Patrik Valkovic PatrikValkovic

View GitHub Profile
@PatrikValkovic
PatrikValkovic / reg.py
Created October 6, 2017 10:08
grammpy demonstration of inversion of regular expression
#!/usr/bin/env python
from string import ascii_lowercase
from grammpy import *
from grammpy_transforms import ContextFree, InverseContextFree
from pyparsers import cyk
class Symb(Nonterminal):
def get(self):
if len(self.to_rule.to_symbols) == 3:
@PatrikValkovic
PatrikValkovic / calc.py
Last active March 13, 2018 15:00
grammpy demosntration on calculator
#!/usr/bin/env python
from string import ascii_lowercase
from grammpy import *
from grammpy_transforms import ContextFree, InverseContextFree, InverseCommon
from pyparsers import cyk
# Terminals
class PlusOperator(Terminal): pass