From 9e8a5abdaa9991edccbac2e238d468f08a48b697 Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 9 Mar 2019 16:52:34 -0300 Subject: [PATCH] package jortsc with setup.py add lark parser as dep --- jortsc/__init__.py | 3 +++ jortsc/main.py | 2 +- jortsc/parser/parser.py | 12 ++++++++++++ setup.py | 14 ++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 jortsc/parser/parser.py create mode 100644 setup.py diff --git a/jortsc/__init__.py b/jortsc/__init__.py index e69de29..da3f54a 100644 --- a/jortsc/__init__.py +++ b/jortsc/__init__.py @@ -0,0 +1,3 @@ +from .main import main + +__all__ = ['main'] diff --git a/jortsc/main.py b/jortsc/main.py index 45c6aa8..fb32335 100644 --- a/jortsc/main.py +++ b/jortsc/main.py @@ -3,7 +3,7 @@ import sys import pprint -from parser.lexer import lex_jorts +from jortsc.parser.lexer import lex_jorts def main(): """main entry point""" diff --git a/jortsc/parser/parser.py b/jortsc/parser/parser.py new file mode 100644 index 0000000..c5e5b39 --- /dev/null +++ b/jortsc/parser/parser.py @@ -0,0 +1,12 @@ + +from lark import Lark + +# TODO: write a grammar +GRAMMAR = """ +yeet +""" + +def parse(string: str): + """Parse""" + parser = Lark(GRAMMAR, parser='lalr', debug=True) + return parser.parse(string) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..45d4212 --- /dev/null +++ b/setup.py @@ -0,0 +1,14 @@ +from setuptools import setup + +setup( + name='jortsc', + version='0.1', + py_modules=['jortsc'], + install_requires=[ + 'lark-parser==0.6.7' + ], + entry_points=''' + [console_scripts] + jortsc=jortsc:main + ''' +)