#! /usr/bin/env python # coding=utf-8 from py_yacc import yacc from util import clear_text from translation import Tran text = clear_text(open('quick_sort.py', 'r').read()) # syntax parse root = yacc.parse(text) root.print_node(0) # translation t = Tran() t.trans(root) print t.v_table
#! /usr/bin/env python #coding=utf-8 from py_yacc import yacc from util import clear_text from translation import trans, v_table text = clear_text(open(r'binary_search.py', 'r').read()) print(text) # syntax parse root = yacc.parse(text) root.print_node(0) # translation trans(root) print(v_table)
#! /usr/bin/env python # coding=utf-8 from py_yacc import yacc from util import clear_text from translation import trans, v_table text = clear_text(open('select_sort.py', 'r').read()) # syntax parse root = yacc.parse(text) root.print_node(0) # translation trans(root) print v_table
def _clear_wiki_text(self): util.clear_text(self._get_wiki_input())
#! /usr/bin/env python #coding=utf-8 from py_yacc import yacc from util import clear_text from translation import trans,v_table text1=clear_text(open('select_sort.py','r').readlines()) text2=clear_text(open('binary_search.py','r').readlines()) # syntax parse root1=yacc.parse(text1) root2=yacc.parse(text2) print("select_sort.py:") print("======================================================") root1.print_node(0) print() print("binary_search.py:") print("======================================================") root2.print_node(0) print('-------------------------------------') # translation print("translation: ") print("select_sort.py:") print("======================================================") trans(root1) print (v_table) print() v_table.clear()
#! /usr/bin/env python # coding=utf-8 from py_yacc import yacc from util import clear_text from translation import trans, v_table text = clear_text(open('example.py', 'r').read()) # syntax parse root = yacc.parse(text) root.print_node(0) # translation trans(root) print v_table
#! /usr/bin/env python # coding=utf-8 from py_yacc import yacc from util import clear_text from translation import Tran text = clear_text(open('1.py', 'r').read()) # syntax parse root = yacc.parse(text) root.print_node(0) # translation t = Tran() t.trans(root) print t.v_table