[untested] first grammar definition with parsimonious

- added parsimonious as requirement
- first try of creating a grammar for job_shop1
This commit is contained in:
Trolli Schmittlauch 2017-06-22 23:12:18 +02:00
parent 6a2911601d
commit 608af7d2ff
3 changed files with 20 additions and 0 deletions

View file

@ -1 +1,2 @@
mypy
parsimonious

View file

View file

@ -0,0 +1,19 @@
from parsomonious.grammar import Grammar
grammar = Grammar(
"""
start = skip_preface
skip_preface = instance_list / ~"."s skip_preface
eol = \n / \r\n
_ = " "
instance_list = problem_instance (sep_line problem_instance eol)* eof
problem_instance = strip_whitespace "instance" _ instance_name eol eol sep_line description eol job_data
description = ~".*"
instance_name = ~"\w"
sep_line = strip_whitespace plus_line strip_whitespace eol
plus_line = ~"\+\+\++"
eof = strip_whitespace plus_line " EOF " plus_line strip_whitespace
strip_whitespace = ~"[\t ]*"
job_data = ~"[ \r\n0-9]*"s
""")