Search the Community
Showing results for tags 'bnf'.
-
Hi everyone Are there any people here that know how to use a parser generator that uses 'bnf' (not 'ebnf'!) i'm using the gold parser: http://goldparser.org/index.htm not possible in autoit: https://www.autoitscript.com/forum/topic/167663-activex-gold-parser-in-autoit-is-this-possible/ What i'm looking for is the best way to parse a list: <List> ::= <Item> ',' <List> | <Item> <Item> ::= Number | String for example, the tree returned from: 'test', 1, 2is: since its not possible in AutoIT code I did it in vb script. this is what i did: ' in the parse loop: Case Rule_List_Comma set result = new list call result.input(.tokens(0).data,.tokens(2).data) ' the list class: class list private arg0 private arg1 public sub input(a,b) set arg0 = a set arg1 = b end sub private sub push(item,byref stack) redim preserve stack(ubound(stack) + 1) stack(ubound(stack)) = item end sub public function value value = array(arg0.value) value2 = arg1.value if isarray(value2) then for each thing in value2 push thing,value next else push value2,value end if end function end class is there a better way to do this? regards, TheAutomator