1 # -*- coding: utf-8 -*-
3 # Copyright © 2014, 2015, 2017 Simon Forman
5 # This file is part of Thun
7 # Thun is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # Thun is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Thun. If not see <http://www.gnu.org/licenses/>.
20 import argparse, io, pkg_resources
21 from .library import initialize, inscribe, Def
22 from .joy import repl, interp
23 from .utils.pretty_print import trace
29 argparser = argparse.ArgumentParser(
31 description='Joy Interpreter',
33 argparser.add_argument(
38 pkg_resources.resource_stream(__name__, 'defs.txt'),
42 type=argparse.FileType('r', encoding='UTF_8'),
44 'Add additional definition files.'
45 ' Can be used more than once.'
48 argparser.add_argument(
50 help='Don\'t show the prompt.',
56 args = argparser.parse_args()
64 Thun - Copyright © 2017 Simon Forman
65 This program comes with ABSOLUTELY NO WARRANTY; for details type "warranty".
66 This is free software, and you are welcome to redistribute it
67 under certain conditions; type "sharing" for details.
68 Type "words" to see a list of all words, and "[<name>] help" to print the
72 dictionary=initialize()
73 for def_stream in args.defs:
74 Def.load_definitions(def_stream, dictionary)
75 stack = j(dictionary=dictionary)