Jump to content

My rpn calculator can't compute negative numbers...


Go to solution Solved by jchd,

Recommended Posts

hi everyone!

I need some help with my rpn calculator.

I first translated it from vbscript to autoitscript and that's when i stumbled on problem one:

(46) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$Stack[ubound($Stack)] = $Item

^ ERROR

After that (and i know this from testing it as a vbscript) it can't work with negative numbers:

"1 - - 2" to Reverse Polish notation = "1 - 2 -" gives me the build in error...

 

Can you guy's help me with my code pleas?

Func Print($what,$er = 0)
        $t = ''
        if $err <> 0 then $t = 'ERROR!'
    MsgBox($er,$st,$what)
EndFunc

Func RPN($Tokenarray)
    Local $Stack = []
    Local $Result
    Local $Operator_B
    Local $Operator_A

    For $Token = 0 To Ubound($Tokenarray)
        If Isoperator($Tokenarray[$Token]) Then
            $Operator_B = Pop($Stack)
            $Operator_A = Pop($Stack)
            If $Operator_A = "" Then
                Print("The user has not input sufficient values in the expression.",16)
                exit
            EndIf
            Switch $Tokenarray[$Token]
                Case "+"
                    $Result = Number($Operator_A,3) + Number($Operator_B,3)
                Case "-"
                    $Result = Number($Operator_A,3) - Number($Operator_B,3)
                Case "*"
                    $Result = Number($Operator_A,3) * Number($Operator_B,3)
                Case "/"
                    $Result = Number($Operator_A,3) / Number($Operator_B,3)
                Case "^"
                    $Result = Number($Operator_A,3) ^ Number($Operator_B,3)
            EndSwitch
            Push($Result,$Stack)
        Else
            Push($Tokenarray[$Token],$Stack)
        EndIf
    Next
    If Ubound($Stack) > 1 Then
        Print("The user input has too many values.",16)
        Exit
    EndIf
    Return pop($Stack)
EndFunc

Func Push($Item, Byref $Stack)
    If Ubound($Stack) > -1 Then
        Redim $Stack[Ubound($Stack) + 1]
        $Stack[Ubound($Stack)] = $Item
    Else
        Local $Stack = [$Item]
    EndIf
EndFunc

Func Pop($Stack)
    $pop = ""
    If Ubound($Stack) > -1 Then
        $Pop = $Stack[Ubound($Stack)]
        Redim $Stack[Ubound($Stack) - 1]
    EndIf
    Return $pop
EndFunc

Func Peek($Stack)
    $peek = ""
    If Ubound($Stack) > -1 Then
        $Peek = $Stack(Ubound($Stack))
    EndIf
    Return $peek
EndFunc

Func Isoperator($Operator)
    Return StringInstr("+-*/^&<=>", $Operator) <> 0 And StringLen($Operator) = 1
EndFunc

Func Precedence($Operator)
    If Isoperator($Operator) Then
        Switch $Operator
            case "^"
                Return 4
            case "*","/"
                Return 3
            case "+","-"
                Return 2
            case "&"
                Return 1
            case "<","=",">"
                Return 0
        EndSwitch
    EndIf
EndFunc

;##################################################################################################

; (4 - -5) = (4|-|-|5) = (4|-|5|-)
;  input      tokens        rpn
Global $calculate_this = ["4","-","5","-"]

Print(rpn($calculate_this))

thanks in advance :) ,

TheAutomator

Edited by TheAutomator
Link to comment
Share on other sites

Without reading the code I'd say 

$Stack[ubound($Stack)] = $Item

should be

$Stack[ubound($Stack) -1 ] = $Item

Which is the highest index of the array.

EDIT:

Also, I can tell you that

If Ubound($Stack) > -1 Then will always be true, assuming it is actually an array.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Without reading the code I'd say 

$Stack[ubound($Stack)] = $Item

should be

$Stack[ubound($Stack) -1 ] = $Item

Which is the highest index of the array.

EDIT:

Also, I can tell you that

If Ubound($Stack) > -1 Then will always be true, assuming it is actually an array.

 

but aren't array's 0 based if you declare them that way?  :huh:

Link to comment
Share on other sites

Local $Stack[10]

UBound($Stack) equals 10, but the highest element is [9] including [0]

 

got it, thanks JohnOne!

problem one: Solved ;)

Func Print($what,$er = 0)
    MsgBox($er,'',$what)
EndFunc

Func RPN($Tokenarray)
    Local $Stack = []
    Local $Result
    Local $Operator_B
    Local $Operator_A

    For $Token = 0 To Ubound($Tokenarray) - 1
        If Isoperator($Tokenarray[$Token]) Then
            $Operator_B = Pop($Stack)
            $Operator_A = Pop($Stack)
            If $Operator_A = "" Then
                Print("The user has not input sufficient values in the expression.",16)
                exit
            EndIf
            Switch $Tokenarray[$Token]
                Case "+"
                    $Result = Number($Operator_A,3) + Number($Operator_B,3)
                Case "-"
                    $Result = Number($Operator_A,3) - Number($Operator_B,3)
                Case "*"
                    $Result = Number($Operator_A,3) * Number($Operator_B,3)
                Case "/"
                    $Result = Number($Operator_A,3) / Number($Operator_B,3)
                Case "^"
                    $Result = Number($Operator_A,3) ^ Number($Operator_B,3)
            EndSwitch
            Push($Result,$Stack)
        Else
            Push($Tokenarray[$Token],$Stack)
        EndIf
    Next
    If Ubound($Stack) - 1 > 1 Then
        Print("The user input has too many values.",16)
        Exit
    EndIf
    Return pop($Stack)
EndFunc

Func Push($Item, Byref $Stack)
    If Ubound($Stack) > -1 Then
        Redim $Stack[Ubound($Stack) + 1]
        $Stack[Ubound($Stack) - 1] = $Item
    Else
        Local $Stack = [$Item]
    EndIf
EndFunc

Func Pop($Stack)
    $pop = ""
    If Ubound($Stack) > -1 Then
        $Pop = $Stack[Ubound($Stack) - 1]
        Redim $Stack[Ubound($Stack) - 2]
    EndIf
    Return $pop
EndFunc

Func Peek($Stack)
    $peek = ""
    If Ubound($Stack) > -1 Then
        $Peek = $Stack[Ubound($Stack) - 1]
    EndIf
    Return $peek
EndFunc

Func Isoperator($Operator)
    Return StringInstr("+-*/^&<=>", $Operator) <> 0 And StringLen($Operator) = 1
EndFunc

Func Precedence($Operator)
    If Isoperator($Operator) Then
        Switch $Operator
            case "^"
                Return 4
            case "*","/"
                Return 3
            case "+","-"
                Return 2
            case "&"
                Return 1
            case "<","=",">"
                Return 0
        EndSwitch
    EndIf
EndFunc

;##################################################################################################

; (4 - -5) = (4|-|-|5) = (4|-|5|-)
;  input      tokens        rpn
Global $calculate_this = ["4","-","5","-"]

Print(rpn($calculate_this))

the negative number evaluation problem is still a big problem..

Link to comment
Share on other sites

Explain it.

the second problem?

well, in reverse polish notation 1|-|-|1 becomes 1|-|1|-

but my version of the rpn calculator can only deal with the '-' operator and does not know what to do with the second '-' (unary operator)..

hope I made my question more clear now :)

Edited by TheAutomator
Link to comment
Share on other sites

Aren't you confusing two distinct operations? Substraction (dyadic) and sign_change (monadic).

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Aren't you confusing two distinct operations? Substraction (dyadic) and sign_change (monadic).

 

Yes, that's the problem.

I'm searching for a simple way to make the calculator function know which one is the subtraction operator and how to deal with

the rest of the negation signs..  :think:

Link to comment
Share on other sites

Differentiate between the regular sub - and some symbol evocating sign change, for instance ±

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I assume the unary (sign change) operator will either be the first instruction or else it will always be directly preceeded by another operator. If this is true, then you can test the type of operator using this rule. I don't know if I am correct - it's just a thought.

Edited by czardas
Link to comment
Share on other sites

This example seems to work also for negative numbers:

 

Global $__iStackElement = 0
Global $oErrorHandler = ObjEvent("AutoIt.Error", "__Catch_COM_Errors")

ConsoleWrite(ReversePolishNotation("- * / 15 - 7 + 1 1 3 + 2 + 1 1") & @CRLF)
ConsoleWrite(ReversePolishNotation("/ 12 3") & @CRLF)
ConsoleWrite(ReversePolishNotation("/ 12 3-") & @CRLF)
ConsoleWrite(ReversePolishNotation("+ 1.25 2.25") & @CRLF)


Func ReversePolishNotation($sPolishNotation) ;coded by UEZ build 2014-09-07
    If StringRegExp($sPolishNotation, "[^\d+|^\-|^\+|^\*|^\^|^\/|^\s|\.]", 0) Then Return SetError(1, 0, "") ;simple error handling only
    Local $oStack = Stack_Init()
    Local $aTokens = StringSplit($sPolishNotation, " ", 2)
    If @error Then Return SetError(2, 0, "")
    Local $sToken, $sOperand1, $sOperand2
    For $sToken = UBound($aTokens) - 1 To 0 Step -1
        Switch $aTokens[$sToken]
            Case "+", "-", "/", "*", "^"
                $sOperand1 = Stack_Pop($oStack)
                If StringRight($sOperand1, 1) = "-" Then $sOperand1 = StringRegExpReplace($sOperand1, "(.+)-", "-$1")
                $sOperand2 = Stack_Pop($oStack)
                If StringRight($sOperand2, 1) = "-" Then $sOperand2 = StringRegExpReplace($sOperand2, "(.+)-", "-$1")
                Stack_Push(Execute($sOperand1 & $aTokens[$sToken] & $sOperand2), $oStack)
            Case Else
                Stack_Push($aTokens[$sToken], $oStack)
        EndSwitch
    Next
    Return Stack_Peek($oStack)
EndFunc   ;==>ReversePolishNotation

#Region Stack UDF
;stack (LIFO) implementation using ActiveXObject "Scripting.Dictionary" -> http://msdn.microsoft.com/en-us/library/x4k5wbx4(v=vs.84).aspx
;coded by UEZ (proof of concept version)
;~ #include-once

;function list:
;Stack_Clear
;Stack_Count
;Stack_Init
;Stack_IsEmpty
;Stack_Peek
;Stack_Pop
;Stack_PrintToConsole
;Stack_Push
;Stack_ToArray

;~ Global $__iStackElement = 0
;~ Global $oErrorHandler = ObjEvent("AutoIt.Error", "__Catch_COM_Errors")

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_Push
; Description ...: adds an element onto the stack
; Syntax ........: Stack_Push($element, $obj)
; Parameters ....: $element             - any kind of an element
;                  $obj                 - must be the an object returned by Stack_Init()
; Return values .: True
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......:
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_Push($element, $obj)
    $obj.Add($__iStackElement, $element)
    $__iStackElement += 1
    Return True
EndFunc   ;==>Stack_Push

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_Pop
; Description ...: returns the topmost element and removes it from the stack
; Syntax ........: Stack_Pop($obj)
; Parameters ....: $obj                 - must be the an object returned by Stack_Init()
; Return values .: topmost element from the stack
;                  on error false and sets error to 1
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......: if stack is empty then error will be set to 1 and 0 returned
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_Pop($obj)
    If Not $__iStackElement Then Return SetError(1, 0, False)
    Local $return = $obj.Item($__iStackElement - 1)
    $obj.Remove($__iStackElement - 1)
    $__iStackElement -= 1
    Return $return
EndFunc   ;==>Stack_Pop

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_Peek
; Description ...: returns the topmost element without removing it from the stack
; Syntax ........: Stack_Peek($obj)
; Parameters ....: $obj                 - must be the an object returned by Stack_Init()
; Return values .: topmost element from the stack
;                  on error false and sets error to 1
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......: if stack is empty then error will be set to 1 and 0 returned
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_Peek($obj)
    If Not $__iStackElement Then Return SetError(1, 0, False)
    Return $obj.Item($__iStackElement - 1)
EndFunc   ;==>Stack_Peek

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_PrintToConsole
; Description ...: prints all stack elements to the console
; Syntax ........: Stack_PrintToConsole($obj)
; Parameters ....: $obj                 - must be the an object returned by Stack_Init()
; Return values .: True
;                  on error false and sets error to 1
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......: if stack is empty then error will be set to 1 and 0 returned
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_PrintToConsole($obj)
    If Not $__iStackElement Then Return SetError(1, 0, False)
    Local $i
    For $i = $__iStackElement - 1 To 0 Step -1
        ConsoleWrite($obj.Item($i) & @CRLF)
    Next
    Return True
EndFunc   ;==>Stack_PrintToConsole

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_ToArray
; Description ...: returns an array with all stack elements
; Syntax ........: Stack_ToArray($obj[, $bReverse = True])
; Parameters ....: $obj                 - must be the an object returned by Stack_Init()
;                  $bReverse            - [optional] a binary value. Default is True. If true topmost stack element is the 1st
;                                         entry in the array, if false then last element
; Return values .: array with all stack elements
;                  on error false and sets error to 1
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......: if stack is empty then error will be set to 1 and 0 returned
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_ToArray($obj, $bReverse = True)
    If Not $__iStackElement Then Return SetError(1, 0, False)
    Local $a = $obj.Items(), $j = UBound($a) - 1
    If Not $j Then Return $a
    If Not $bReverse Then Return $a
    Local $i, $aRevers[$j + 1]
    For $i = 0 To $j
        $aRevers[$i] = $a[$j - $i]
    Next
    Return $aRevers
EndFunc   ;==>Stack_ToArray

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_Count
; Description ...: return the amount of stack elements
; Syntax ........: Stack_Count($obj)
; Parameters ....: $obj                 - must be the an object returned by Stack_Init()
; Return values .: the amount of stack elements (an integer value)
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......:
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_Count($obj)
    Return $obj.Count()
EndFunc   ;==>Stack_Count

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_IsEmpty
; Description ...: checks whether stack is empty
; Syntax ........: Stack_IsEmpty($obj)
; Parameters ....: $obj                 - must be the an object returned by Stack_Init()
; Return values .: True, if stack is empty, otherwise false
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......:
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_IsEmpty($obj)
    Return $obj.Count() = 0
EndFunc   ;==>Stack_IsEmpty

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_Clear
; Description ...: clears all stack elements
; Syntax ........: Stack_Clear($obj)
; Parameters ....: $obj                 - must be the an object returned by Stack_Init()
; Return values .: None
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......:
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_Clear($obj)
    $obj.RemoveAll()
    $__iStackElement = 0
EndFunc   ;==>Stack_Clear

; #FUNCTION# ====================================================================================================================
; Name ..........: Stack_Init
; Description ...: initialize a stack object
; Syntax ........: Stack_Init()
; Parameters ....: None
; Return values .: an dictionary object
;                  on error false and sets error to 1
; Author ........: UEZ
; Version .......: 0.90 build 2014-04-14
; Remarks .......:
; Related .......: data types
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func Stack_Init()
    Local $oDictionary = ObjCreate('Scripting.Dictionary')
    If @error Then Return SetError(1, 0, False)
    Return $oDictionary
EndFunc   ;==>Stack_Init

;internal functions
Func __Catch_COM_Errors()
    ConsoleWrite( _
            "A COM error has occured!" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oErrorHandler.description & @CRLF & _
            "err.windescription:" & @TAB & $oErrorHandler & @CRLF & _
            "err.number (hex) is: " & @TAB & Hex($oErrorHandler.number, 8) & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oErrorHandler.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oErrorHandler.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oErrorHandler.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oErrorHandler.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oErrorHandler.helpcontext & @CRLF _
            )
EndFunc   ;==>__Catch_COM_Errors
#EndRegion Stack UDF
Edit: added ^ operator.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

My take:

#include <Array.au3>

Func Print($what, $err = 0)
        $t = ''
        if $err <> 0 then $t = 'ERROR!'
    MsgBox($err, $t, $what)
EndFunc

Func Bye($iCause)
    Local Const $aReason = [ _
        "Invalid input.", _
        "The user has not input enough values in the expression.", _
        "The user has input too many values in the expression." _
    ]
    Print($aReason[$iCause], 16)
    Exit
EndFunc

Func RPN($aTokens)
    If UBound($aTokens) < 1 Then Bye(0)
    Local $iToken = 0
    While Ubound($aTokens) > 1 And $iToken < UBound($aTokens)
        If $aTokens[$iToken] = "±" Then        ; only one monadic operator
            $aTokens[$iToken - 1] = -$aTokens[$iToken - 1]
            _ArrayDelete($aTokens, $iToken)
            $iToken -= 1
        ElseIf StringInstr("+-*/^&<=>", $aTokens[$iToken]) Then
            If $iToken < 2 Then Bye(1)
            Switch $aTokens[$iToken]        ; process dyadic operators
                Case "+", "-", "*", "/", "^"
                    $aTokens[$iToken - 2] = Execute(Number($aTokens[$iToken - 2]) & $aTokens[$iToken] & Number($aTokens[$iToken - 1]))
                Case Else
                    Bye(2)
            EndSwitch
            _ArrayDelete($aTokens, $iToken)
            _ArrayDelete($aTokens, $iToken - 1)
            $iToken -= 2
        Else                                ; must be a value
            $iToken += 1
        EndIf
    WEnd
    Return $aTokens[0]
EndFunc


;~ Func Precedence($Operator)
;~     If Isoperator($Operator) Then
;~         Switch $Operator
;~             case "±"
;~                 Return 5
;~             case "^"
;~                 Return 4
;~             case "*","/"
;~                 Return 3
;~             case "+","-"
;~                 Return 2
;~             case "&"
;~                 Return 1
;~             case "<","=",">"
;~                 Return 0
;~         EndSwitch
;~     EndIf
;~ EndFunc

;##################################################################################################

; (4 - ±5) / 3.14 = 4|5|±|-|3.1415926|/
;      input              rpn
Global $calculate_this = [4, 5, "±", "-", 3.1415926, "/"]

Print(rpn($calculate_this))

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

czardas,
no problem, thanks for the help :)
 
UEZ,
trying to figure out what you just did there,
 
  1. first you check what the token is,
  2. if it is a number:
  3.     you push it to the stack,
  4. if it is an operator:
  5.     Operand1 = first value
  6.         if the last char of Operand1 is a '-' then Operand1 = '-' & the value of Operand1 without the '-'
  7.     Operand2 = second value
  8.         if the last char of Operand2 is a '-' then Operand2 = '-' & the value of Operand2 without the '-'
  9.         (tell me if i'm wrong here, i'm a noob if it comes to regex..)
  10.     then let autoit evaluate(Operand1 & operator token & Operand2)
is this correct?
well, the shunting yard algorithm i made returns the tokens token by token, '3-' could never be a single token, to would rather be '3', '-'
 
jchd,
I never heard about this '±' operator before, i don't even know how to type it...
what i'm trying to find out is how to let my script know how to do '1 - -2'
so i don't want to use '±', want it to calculations based on a simple basic syntax with only '+','-','*','/' and '^'.
made a tokenization function that converts "1+2--3*5&"abc" to array["1","+","2","-","-","3","*","5","&",'"abc"'] and if
the current rpn calculator (after conversion to reverse polish notation) sees the extra minus it does not know what to do with it..
thanks for the help and your example, i didn't know you actually wanted to put that symbol into the algorithm.
Edited by TheAutomator
Link to comment
Share on other sites

That isn't going to work anyday, period.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
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
 Share

×
×
  • Create New...