This adds an optional templating engine to the compiler, allowing users to customize the output for any assembler or syntax that they desire. It includes two such templates, one for sjasm (matching the current format that the compiler is hardcoded to emit), and an equivalent WLA-DX version that is similarly barebones. Future versions might include greater use of advanced WLA-DX features such as .DSTRUCT and better use of child labels.
If a user passes the -t or --template, it will invoke the Jinja2 templating engine. If the template option is omitted, it will revert to the standard hardcoded format. Users do not need Jinja2 in order to run the compiler.
For example, typing python tmucompile.py test.tmu will result in the hardcoded (sjasm-compatible) output in test.asm .
Using python tmucompile.py -t templates/song-sjasm.jinja test.tmu output_sjasm.asm will load the templating engine and output it as output_sjasm.asm .
It uses the argparse module to simplify options and required command line parameters. This should simplify expansion in the future.
A requirements.txt is included to allow dependencies to be pulled in via pip.
This adds an optional templating engine to the compiler, allowing users to customize the output for any assembler or syntax that they desire. It includes two such templates, one for sjasm (matching the current format that the compiler is hardcoded to emit), and an equivalent WLA-DX version that is similarly barebones. Future versions might include greater use of advanced WLA-DX features such as
.DSTRUCT
and better use of child labels.If a user passes the
-t
or--template
, it will invoke the Jinja2 templating engine. If the template option is omitted, it will revert to the standard hardcoded format. Users do not need Jinja2 in order to run the compiler.For example, typing
python tmucompile.py test.tmu
will result in the hardcoded (sjasm-compatible) output intest.asm
.Using
python tmucompile.py -t templates/song-sjasm.jinja test.tmu output_sjasm.asm
will load the templating engine and output it asoutput_sjasm.asm
.It uses the
argparse
module to simplify options and required command line parameters. This should simplify expansion in the future.A
requirements.txt
is included to allow dependencies to be pulled in viapip
.