Update Makefile to make it compile with recent pilex
[c_to_python.git] / c_to_python.py
1 #!/usr/bin/env python3
2
3 # Copyright (C) 2018 Nick Downing <nick@ndcode.org>
4 # SPDX-License-Identifier: GPL-2.0-only
5 #
6 # This program is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free Software
8 # Foundation; version 2.
9 #
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU General Public License along with
16 # this program; if not, write to the Free Software Foundation, Inc., 51
17 # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18
19 import t_def
20 import element
21 import sys
22 import xml.etree.ElementTree
23 import y_tab
24
25 root = y_tab.yyparse(t_def.AST.TranslationUnit)
26 element.serialize(root, 'a.xml', 'utf-8')
27 root = element.deserialize('a.xml', t_def.factory, 'utf-8')
28
29 context = t_def.Context()
30 root.translate_translation_unit(context)
31 sys.stdout.write(''.join(context.lines))