I have written some simple Matlab-to-X transpilers and am looking for ways to improve.
The bulk of the work is variable declaration, so type inference and keeping book of the scope.
Code conversion itself is rather primitive, changing some parentheses and putting the main function to the end of the code. This works ok since I translate machine-generated source code with limited syntax.

Most, if not all transpilers seem to use an AST. Going that route, I apparently need to grind down the source language into its smallest pieces, parse these tokens into meaningful chunks, before spitting out the syntax of the target language. As I see it, for the AST approach I would have to implement the complete language. The bookkeeping does not seem easier. Instead of a list I now traverse a tree. Variable nodes with type declarations could be added but appear spread out and not the simple list I am used to.

Can someone can fill my mental gap understanding AST representation and use? Or give some recommendations for my “limited syntax” translation task. Thx.