MacroTranslator#
Qualified name: makros.macro\_creation.MacroTranslator
- class makros.macro_creation.MacroTranslator#
Bases:
ABC
This is the base class of your translator. You should implement all of the methods defined on it youself
Note: You must name the class that extends this
Translator
or else it will not be picked up by makrosWhen implementing a translator, I recommend that you use the visitor pattern. For more information, crafting interpreters has great documentation.
Methods
This method is called to translate the AST that is returned by the parse method on your parser.
- abstract translate(ast: any) str #
This method is called to translate the AST that is returned by the parse method on your parser.
- Args:
ast (any): The AST generated by your parser method
- Returns:
str: The python code generated by your macro