Search the Community
Showing results for tags 'programminglanguage'.
-
Hi everyone! I'm using AutoIt for several years now and I really get the hang of it! I'm quite the curious OCD perfectionist kind of guy, so I can't help wondering.. what would be the best way to program stuff for the compiler / interpreter / scripting engine? We're talking about the inner workings of the AutoIt's core here, and how to give it as less friction as possible but also take care of the machine running the script. For example, Imagine a script where we would constantly have to assign a Boolean value to a variable: ; A: local $bool = false $bool = true $bool = true $bool = false ; B: local $bool = false check(true) check(true) check(false) func check($b) if $bool = $b then return $bool = $b endfunc In this case, would it be better to just overwrite (A) the variable or first check if we really need to (B)? What would be best for the computers memory if it had to do this for a year non stop? Another example, imagine you're writing a function with an if statement. If you would look under the hood of AutoIt, what would be the best way to give your computer as less work / code nesting stack filling as possible: ; A: func decide($b_Input) if $b_Input then ;do something else ;do something else endif endfunc ; B: func decide($b_Input) if $b_Input then ;do something return endif ;do something else endfunc Last one for now: ; A: while 1 ; do stuff wend ; B: while true ; do stuff wend Isn't AutoIt taking an extra step in converting 1 to a Boolean in example (A)? Or is it the other way around and does the (B) way make AutoIt first convert a keyword (true or false) to a numerical value (0 or 1). I think this kinda detail stuff is quite interesting, makes me wonder how AutoIt converts and runs our code. What are your opinions on this topic? Any coders who know more about the inner workings of AutoIt? Any people like me who ask themselves similar questions (with examples)? Let me know! 😉
- 41 replies
-
- programminglanguage
- programming
-
(and 1 more)
Tagged with:
-
I'm writing a recursive decent parser in Autoit! The programming language i'm making is called HighLevel. I'm doing this for learning purposes, because it's fun and because I can implement it into my other project: Fullscreen Console With custom programming language! It's not easy... In Autoit you don't have objects like in Java or Visual Basic, so I had to figure out a way to still convert the code to an abstract syntax tree. I used nested array's and array based dictionary's instead of objects. The code is still very dirty and I need to make a lot of modifications but if you're careful with testing you'll see what it can do already. Console window Because this code eventually will get implemented into my console project I crafted a nice little console window (with a custom sci-fi looking theme, yeah i was a little bored haha). {ESC} is your panic button for now, it terminates the script completely. If you get an error while opening a script the text will turn red. To minimize it press the blue button, to close it use the red one, to drag the gui just grab it on one of the sides. The console window will display what you write to it with your "HighLevel-script" and some additional information: How to test it: Download: HighLevel.Au3, Debug.Au3 (includes a function to display nested arrays for debugging), GUI.bmp (for the console) Compile the Autoit code to EXE. The GUI.bmp must be in the same folder as the EXE file! Write a HighLevel-script (text file) and drag it into the compiled autoit-exe. The custom made little console window will pop up in the left top corner of your screen and your HighLevel-script (the text file) will be interpreted and executed. The Language: exit script: Abort show / hide the console: Show Hide write to/clear the console: Write 'this is a ''string''!' Clear variables: test_var_1 = 123 some_list = ['a', 5, true] some_list[1] = 3 math = 1 + 2 * 3 / 4 - -5 & test_var beep (under construction): Beep F, optD wait X seconds: Wait X Messages: Message 'Hello World!' move/click the mouse: Move X, Y Click send keys (under construction): Send 'HighLevel', True if's: If false ElseIf true # this part will run Else End subs: Sub X # do stuff End Call X for loops: For X = 1 to 10 # X iterates End Values: Input 'Give me input' Random YesNo 'yes or no' operators: + - * / & > = ! < ( ) And Not Or Example script: # my first HighLevel script message 'Hello World!' message 'Lets write to the console...' clear # clear the console... list = ['a', 16, true] for i = 0 to 2 write list[i] wait 1 end sub test if YesNo 'would you like to quit?' message 'Goodbye!' abort else write 1 + 2 * 3 & ' math!' end end call test test script.HighLevel GUI.bmp Debug.au3 HighLevel.au3
-
- interpreter
- parser
-
(and 3 more)
Tagged with: