Sign in to follow this  
Followers 0
twitchyliquid64

Experimental (Academic) AutoIT Script Interpreter [C++]

23 posts in this topic

#21 ·  Posted

The point is not to not use stacks.

Also, inb4 pratt parser.

It does use a THE stack, as it relies heavily on recursion :) I did write a non recursive version using a stack for assembly as well. I guess what you mean to say is that it is better to not maintain a stack explicitly.

However, since all AutoIt statements have signal tokens (e.g. there is some unique token at the start of every statement: switch, select, while, for, do, func...), A predictive parser is probably the right way to go. Pratt's is more suited to maths expressions, its main strength being resolving ambiguity easily, allowing it to be easily extended.

Reading through my textbook now, most of the algorithms are stack and table driven (or recursive descent). I definitely think you could do better than having two separate parsers though. That does not make much sense.

Share this post


Link to post
Share on other sites



#22 ·  Posted

It does use a THE stack, as it relies heavily on recursion :) I did write a non recursive version using a stack for assembly as well. I guess what you mean to say is that it is better to not maintain a stack explicitly.

I didn't mean to say better or worse, really. My "The point is not to not use stacks" was aimed at the fact that because of the usage of recursion to drive the algorithm you are using a stack anyway. You can't really do without a stack (or table as you said).

I agree with the rest of your post. Didn't read his code so wouldn't know about two parsers, but I can see the merit in two parsing strategies. If you use a method where you parse BNF and produce a parser that way, you are using two parsers. But again I say, I didn't read his code.

Share this post


Link to post
Share on other sites

#23 ·  Posted

I didn't mean to say better or worse, really. My "The point is not to not use stacks" was aimed at the fact that because of the usage of recursion to drive the algorithm you are using a stack anyway. You can't really do without a stack (or table as you said).

Ah right, I misread your post. I guess when you are talking about C++, the standard does not define HOW the function call stack should be implement it... It could be a singly linked list quite easily (linked backwards though) so then it wouldn't be a stack at all, so I guess when you are writing in a language that deals with a standard rather than a platform it is not quite right to say recursion uses a stack. Then again, I have never read the standard, I am guessing that they standardise behaviour not implementation.

I agree with the rest of your post. Didn't read his code so wouldn't know about two parsers, but I can see the merit in two parsing strategies. If you use a method where you parse BNF and produce a parser that way, you are using two parsers. But again I say, I didn't read his code.

I didn't either, but he said he was using:

-Stateful Recursive Decent Parser

-Shunting yard algorithm for expression evaluation

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

  • Similar Content

    • carl1905
      [Solved] Extracting text from string and reinsert it.
      By carl1905
      Hi, I'm looking for a way to extract specific binary text data from string(except between "[", "]") and convert it.
      And put it back to text. How can I do it? Can someone help me?
      Example $text = "[1F010005300020FF]82CD0A[030005300020FF]8177[1F12010000E6300020FF]8178[1F030000300020FF]82F00A8A6F82A682DC82" Rearrange the text like below [1F010005300020FF] 0x82CD0A => StringToBinary(0x82CD0A) == A [030005300020FF] 0x8177 => StringToBinary(0x8177) == B [1F12010000E6300020FF] 0x8178 => StringToBinary(0x8178) == C [1F030000300020FF] 0x82F00A8A6F82A682DC82 => StringToBinary(0x82F00A8A6F82A682DC82) == D $output = "[1F010005300020FF]A[030005300020FF]B[1F12010000E6300020FF]C[1F030000300020FF]D"  
    • Valnurat
      Autocomplete Combobox
      By Valnurat
      I would like to use the Autocomplete function for the combobox, but I don't know how.
      ; Create a GUI with various controls. Local $hGUI = GUICreate("Find Computer Owner", 300, 200) ; Create a combobox control. Local $idComboBox = GUICtrlCreateCombo("", 2, 2, 296, 20) Local $idMylist = GUICtrlCreateList("", 2, 24, 296, 140) GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling Local $idClos = GUICtrlCreateButton("Close", 210, 170, 85, 25) _AD_Open() ; Add files _GUICtrlComboBox_BeginUpdate($idComboBox) Local $sFill = "" For $i = 0 to UBound($aNames) -1 Local $aUserInfo = _AD_GetObjectsInOU($aNames[$i],"","","displayName,distinguishedName") ;_ArrayDisplay($aUserInfo) for $x = 1 To $aUserInfo[0][0] If $aUserInfo[$x][0] <> "" Then $sFill &= $aUserInfo[$x][0] & " ; " & $aUserInfo[$x][1] & "|" EndIf Next ; _ArrayDisplay($aUser,"1") Next $sFill = StringTrimRight($sFill, 1) GUICtrlSetData($idComboBox, $sFill, "") _GUICtrlComboBox_EndUpdate($idComboBox) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $sComboRead = "" ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClos ExitLoop Case $idComboBox $sComboRead = GUICtrlRead($idComboBox) $sComboRead = StringTrimLeft($sComboRead,StringInStr($sComboRead,';')) $aComputerOwner = _AD_GetObjectsInOU("OU=Firm,DC=AD,DC=Firm,DC=ORG","(&(objectclass=computer)(managedby=" & $sComboRead & "))",Default,"cn") If $aComputerOwner <> "" Then For $i = 1 to $aComputerOwner[0] GUICtrlSetData($idMylist, $aComputerOwner[$i] & "|") Next Else GUICtrlSetData($idMylist, "No computer|") EndIf EndSwitch WEnd _AD_Close() ; Delete the previous GUI and all controls. GUIDelete($hGUI) Can someone guide me?
    • Vexhero
      Simple converting AutoIt To C#
      By Vexhero
      Hello! I have a script in autoit which I made yesterday and Im still getting the hang of autoit
      My question is, is there anyone here who would be able to explain how the convertion would go between AutoIt and C# when it comes to these lines of code, would I need to declare an array to show the $x & $y position? Also The LC is a function I have a bit down the code

       
      While (Not($it_full)) $pixels = PixelSearch(257, 181, 276, 202,0xA19695,10) ;Check color If NOT(@error) Then LC($pixels[0],$pixels[1]) EndIf $pixels = PixelSearch(693, 479, 729, 504,0x000001,3) ;Search If NOT(@error) Then ; MsgBox(0,"Title","Found It!") $it_full = True Sleep(8000) EndIf WEnd  
    • MrTheDzam
      WinHTTPObj Library didn't work with redirect page?
      By MrTheDzam
      Hello guys!

      I changed my website's login page yesterday. In that file, i used header() function to redirect user from login page to error page.
      But now my script (use WinHttpObj library) can't work. But if i change the login page to old page (without redirect) then my script works

      How can i fix that? 
    • carl1905
      Transforming text using table file.
      By carl1905
      I attached simple text that is written in Japanese(01 Original text) and Korean(02 Transformed text).
      It contains just 1 word that means "Quantum Mechanics". The question is how can I transform 01 to 02 using table.txt file?
      sample.zip