Sign in to follow this  
Followers 0
twitchyliquid64

How does the autoit interpreter do...

21 posts in this topic

Hi all,

Been looking through the public bits of the autoit source code, and there are a couple of things I dont understand (probably deriving from my lack of experience with c++)

I was wondering how Autoit Implements...

VARIABLE Lookup and storage:

My guesses is that variables are organised into some sort of ordered linked list, Which is used for lookup. Is this correct?? If not, how is it implemented??

Interrupts:

Functions like HotKeySet can interrupt the execution of the script, calling another function instead. How does autoit do this??

Parser:

Whats the name of the algorithm implemented? Is it the Shift/Reduce Thingy???

Thanks heaps in advance,

-Hyperzap.

@Manadar: I am still studying as well!


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try the file thats cryptically called variable_table.cpp. The parser is a left-to-right parser which implements shunting yard, among other things.

Edited by Manadar

Share this post


Link to post
Share on other sites

Magic.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Try the file thats cryptically called variable_table.cpp. The parser is a left-to-right parser which implements shunting yard, among other things.

Yes - I have seen variable_table.cpp, what I mean is that I dont understand it, I can see It implements some kind of data structure with pointers to other data structures, which suggests to me that it is a linked list, but then there is more to the story -as some kind of greater than/less than comparision is used (I think), which suggests to me that there is an ordering and lookup system. How this is implemented, what is used as the basis for ordering, what the memory representation actually looks like, is yet to be discovered (assuming of course, that I am right).

Shunting Yard? Really? Its a very LONG implementation. It thought it was an LALR Shift/Reduce Algorithm. Hmmmm.

Any Idea how execution is interrupted? (eg: HotKeySet)??????

Thx.

Edited by hyperzap

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Magic.

Indeed. But the human body is magic and medical science has allowed us to take the interesting bits out of it as well.

Edited by hyperzap

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites

It's shift/reduce. The public source code is almost unrecognizable to what it is like now however. The variable look up table IIRC was a linked list but may be a binary tree now for more speed. But at the most basic level, yeah a linked list.

Share this post


Link to post
Share on other sites

It's shift/reduce. The public source code is almost unrecognizable to what it is like now however. The variable look up table IIRC was a linked list but may be a binary tree now for more speed. But at the most basic level, yeah a linked list.

thankyou.

also, how are you doing interrupts? (like when hotkeyset interrupts code execution to run its corresponding function.)???


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites

They are not really interrupts they are more like "doing something else rather than running a line of script". Before a line of code is run we check if there are any windows messages that need processing - hotkeys appear as one of these messages. So then we just save the state of the script and then recursively execute the hotkey function.

Share this post


Link to post
Share on other sites

Since someone has been asking already, I have one question that I've been trying to get from the source code: How do you handle variant casting? I've posted a question on stackoverflow (here) to try and see what systems other people recommend.

Share this post


Link to post
Share on other sites

#10 ·  Posted

You have to store some indicator of what you are holding. If it matches the destination type, you're done.

If it can be converted (based on rules you define), convert it.

If it can't, error out.

That's how any cast works.

Share this post


Link to post
Share on other sites

#11 ·  Posted

Yes, but how would you define the rules? That's the bit I'm interested in.

Share this post


Link to post
Share on other sites

#12 ·  Posted

Yes, but how would you define the rules? That's the bit I'm interested in.

Create a variant-class which will be used to store variables. Implement the operators including automatic conversion. If you don't want to do it from scratch, use COM-Varaints as a basis.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

#13 ·  Posted

Create a variant-class which will be used to store variables. Implement the operators including automatic conversion. If you don't want to do it from scratch, use COM-Varaints as a basis.

I've already done that. I have a variant class that overloads the operators and the only thing I need to do is the conversion/casting itself. Of the conversion and casting I have a header defining the type, which is extended by the variant class to include the data.

All I am interested in is the specific process of casting data D from type F to type T, knowing that such a cast is possible, and F != T.

Share this post


Link to post
Share on other sites

#14 ·  Posted

The rules are what you feel like. This is a pretty common variant rule set.

Can convert to string if it's a string, number, or boolean.

Can convert to a number if it's a number. Can parse string for number if you choose. Can optionally convert booleans to 0s and 1s.

Can convert to a boolean using rules like 0/"" = false, everything else = true.

Arrays can't be converted to anything else except maybe strings if they are character arrays.

Share this post


Link to post
Share on other sites

#17 ·  Posted

Always a good time to renovate.

It has been a while since a new version of autoit has been released. Autoit v4 has been forshadowed for some time. Is there going to be another version?? if yes what will be included??? how can we contribute??? when will it be released???

If the answer is yes, Im pretty sure there is an army of people who are willing to help out in any way.


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

People have been talking about v4 since v3 came out.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

People have been talking about v4 since v3 came out.

I'm curious. Whose suggestion was to edit the post? Manadar's? Edited by trancexx

♡♡♡

.

eMyvnE

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