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

    • Valnurat
      Graph in AutoIT
      By Valnurat
      Sorry for posting this, but I have search the forum for how to put a graph to my project and I found several hits.
      I found this https://www.autoitscript.com/forum/topic/104399-graphgdiplus-udf-create-gdi-line-graphs/?do=findComment&comment=1311822 but I'm not sure if this is still a live.
      I posted a question in it, but no answer yet.
      Is the thread still alive or can someone point me to UDF that's working.
      Thank you.
    • OMGWTFLOLBBQ
      Text to Array
      By OMGWTFLOLBBQ
      Hello!
       I've been going through all of the help files and examples, but I feel lost. I can't seem to find what I need. Essentially, what I'm doing is simple(in my head).
      Create a file based on the information needed, select a line in that file, then put that line back in DOS. My code is below, I know it's messy, but I'll take the heat if you can help.
       
      ;BitlockerUpdate ;2016.05.24 HotKeySet("{ESC}", "Terminate") Run("C:\Windows\System32\CMD.exe") ;open command prompt Sleep(500) ;sleep half second if ProcessExists("cmd.exe") Then winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt Send("C:") Send("{ENTER}") send("CD{SPACE}%windir%\sysnative\") send("{ENTER}") EndIf ;create file with Bitlocker Protectors Send("manage-bde.exe{SPACE}-protectors{SPACE}-get{space}c:{space}>{Space}%userprofile%\Desktop\protectors.txt") ;send code "manage-bde -protectors -get c: > %userprofile%\Desktop\protectors.txt" Send("{ENTER}") ;send enter key to create text file on desktop with protectors Sleep(1000) ;sleep one second(1s) ;edit txt file/create array, pull line and paste into new file, copy text then paste into cmd window below ;update data if ProcessExists("cmd.exe") Then winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt Send("manage-bde.exe{SPACE}-protectors{SPACE}-adbackup{SPACE}c:{SPACE}-id{SPACE}{COPIEDINFORMATIONGOESHERE}") Send("{ENTER}") ;don't forget to delete temp file if you create one created. EndIf ;remove files if ProcessExists("cmd.exe") Then winactivate("Administrator: C:\Windows\System32\CMD.exe") ;refocus command prompt Send("DEL{SPACE}%userprofile%\Desktop\protectors.txt") ;send code to delete protectors.txt Send("{ENTER}") ;don't forget to delete temp file if you create one created. EndIf MsgBox(0,"Done","Copy and upload are done. Please check Computer in AD.") Func Terminate() Exit 0 EndFunc  
      The protectors.txt file looks like this:
      BitLocker Drive Encryption: Configuration Tool version 6.1.7601 Copyright (C) Microsoft Corporation. All rights reserved. Volume C: [OSDisk] All Key Protectors TPM: ID: {0000000-0000-0000-0000-0000000} Numerical Password: ID: {1000000-1000-1000-1000-1000000} Password: 000000-000000-000000-000000-000000-000000-000000 Data Recovery Agent (Certificate Based): ID: {2000000-2000-2000-2000-2000000} Certificate Thumbprint: 1111111a1aa1a1aa1a1a1a1aaaaaa1aaa1 I would specifically need the line after Numerical Password. 
      Original line:      ID: {1000000-1000-1000-1000-1000000}
      Needed information: -ID: {1000000-1000-1000-1000-1000000}
       
      I apologize in advance for inconveniencing anyone with my silly issues. Hopefully this can stand as a great learning experience for both me and anyone else looking.
       
    • PINTO1927
      open excel and update pivot
      By PINTO1927
      hello guys, I'm doing one excel pivot connected to a mysql script to display it in a table array . I need you to open the excel file , the pivot is updated .
       
      where do I fix it?
       
       
    • PINTO1927
      view result sql into array
      By PINTO1927
      Hi guys,
      You can run a sql query in a script of autoit ? I would like to see the result in an array table ..
      Thank's
    • Valnurat
      I need a guideline for storage of data.
      By Valnurat
      I'm looking for an cool and easy solution for storage of data. I was thinking of an array, but was stuck in how I can search and move data from one column to another column.
      In exampel 1 have some numbers 1 to 3 and they are in my column0
      In exampel 2 I want to search for number 2 and move it to C1
      In exampel 3 I want to search for number 3 and move it to C1
      In exampel 4 I want to search for number 3 and move it to C2
      In exampel 5 I want to search for number 1 and move it to C1 and it should be before number 2
       
      Exampel 1 Exampel 2 Exampel 3 Exampel 4 Exampel 5 C0 C1 C2 C0 C1 C2 C0 C1 C2 C0 C1 C2 C0 C1 C2 1 1 2 1 2 1 2 3 1 3 2 3 3 2 3 How could this be done?