Sign in to follow this  
Followers 0
TypeIt

Translator into AutoIt

7 posts in this topic

I'm writing a translator that translates another program written in something similar to AutoIt into AutoIt. That translator performs a static type check, then removes the type annotations and rewrites expressions and statements that AutoIt does not allow (currently only array literals and names) into something that the AutoIt interpreter will accept.

Example:

Func Fibonacci (n as number)
    Return n == 0 ? 1 : n * Fibonacci (n - 1)
EndFunc
Fibonacci (["array", "of", "strings"]) ; type error
becomes

Func Fibonacci ($n)
    Return $n == 0 ? 1 : $n * Fibonacci ($n - 1)
EndFunc
Local $temp1 = ["array", "of", "strings"]
Fibonacci ($temp1)
I'm planning to include function overloading and static overload resolution, and maybe a runtime type check for the arguments based on the specified or inferred parameter types. Do you have any other ideas?

Share this post


Link to post
Share on other sites



Not according to the output in the OP. That's the point I am making.

I don't agree with every default of Tidy. The lexer removes whitespace; I'm doing my best to make the output readable.

The lexer also removes comments. Before adding new comments I'd like to preserve existing comments. :)

But adding a comment containing the name of the function should be easy. I added an option.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0