<s> import os <EOL> from os . path import dirname , join , exists <EOL> from textx . metamodel import metamodel_from_file <EOL> from textx . export import metamodel_export , model_export <EOL> this_folder = dirname ( __file__ ) <EOL> class PrimitiveType ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , parent , name ) : <EOL> self . parent = parent <EOL> self . name = name <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> def get_entity_mm ( debug = False ) : <EOL> """<STR_LIT>""" <EOL> type_builtins = { <EOL> '<STR_LIT>' : PrimitiveType ( None , '<STR_LIT>' ) , <EOL> '<STR_LIT:string>' : PrimitiveType ( None , '<STR_LIT:string>' ) <EOL> } <EOL> entity_mm = metamodel_from_file ( join ( this_folder , '<STR_LIT>' ) , <EOL> classes = [ PrimitiveType ] , <EOL> builtins = type_builtins , <EOL> debug = debug ) <EOL> return entity_mm <EOL> def main ( debug = False ) : <EOL> entity_mm = get_entity_mm ( debug ) <EOL> dot_folder = join ( this_folder , '<STR_LIT>' ) <EOL> if not os . path . exists ( dot_folder ) : <EOL> os . mkdir ( dot_folder ) <EOL> metamodel_export ( entity_mm , join ( dot_folder , '<STR_LIT>' ) ) <EOL> person_model = entity_mm . model_from_file ( join ( this_folder , '<STR_LIT>' ) ) <EOL> model_export ( person_model , join ( dot_folder , '<STR_LIT>' ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
