translate(filename; kwargs...)

Translate filename, which must be a Python file with .py extension. The output is written to the same path with .py replaced by .jl, if this does not yet exist, otherwise with extension .crude.jl.

translate(dirname; kwargs...)

Translate all python files in the directory dirname.

translate(source, custom_translations...; kwargs...)
translate(source, custom_translations::Vector; kwargs...)

Translate file or directory source with additional custom_translations. A custom translation is a function which receives a vector of tokens and returns a possibly modified vector of tokens.

keyword arguments:

  • recursive: When the source is a directory, translate files also in all subdirectories, recursively. Defaults to false.

  • overwrite: If the output .jl file already exists, overwrite it instead of writing to .crude.jl file. Defaults to false.

  • include_base_translations: If false, only do a minimal translation. Defaults to true. This can be used if you want to do a fully customized translation.

  • verbose: If true, print the output sequence of tokens. Defaults to false. Mostly useful with a single short file to figure out how to design a custom translation function.