2 # -*- coding: utf-8 -*-
4 =======================================
5 module_name: vut_front_end
6 ---------------------------------------
7 Author: Rodrigo Peixoto
9 ---------------------------------------
11 - This module runs all the gerenation
13 =======================================
15 ======================================================================
17 This program is free software: you can redistribute it and/or modify
18 it under the terms of the GNU General Public License as published by
19 the Free Software Foundation, either version 3 of the License, or
20 (at your option) any later version.
22 This program is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 GNU General Public License for more details.
27 You should have received a copy of the GNU General Public License
28 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 =======================================================================
32 from vut_checker
import *
33 from vut_generator
import *
34 from vut_parser
import *
36 ARGS_CAN_BE
= ['skel']
38 class InvalidArgumentException(Exception):
41 def run_vut_generator(args
=[]):
48 if args
[1] in ARGS_CAN_BE
:
52 raise InvalidArgumentException()
54 elif (len(args
) == 2):
57 raise InvalidArgumentException()
59 print "#################"
60 print "# @VUTGenerator #"
61 print "#################"
62 print "Phases: Check -> Parse -> Code Generation"
63 print "\nPHASE 1 [Check] --------------------------------------------\n"
64 VUTChercker(file_name
).check_all()
65 print "\nPHASE 2 [Parse] --------------------------------------------\n"
66 vm
= VUTParser(file_name
).parse_all()
67 print "\nPHASE 3 [Code Generation] --------------------------------------------\n"
68 VUTGenerator(vm
,gen_param
).gen()
69 #VUTGenerator(vm).gen()
70 print u
"\n\nGeneration complete @VUTGenerator."
72 except InvalidArgumentException
:
73 print "The arguments are not valid. Please, check it out."
75 except KeyboardInterrupt:
76 print u
"\n\nGeneration interrupted! @VUTGenerator."
78 if __name__
=="__main__":
79 run_vut_generator(None,"skel","example5.vut")