tag:blogger.com,1999:blog-21052732.post9132628435420414888..comments2019-05-08T17:13:18.329-07:00Comments on Ideas and essays on code development: JavaScript pattern matchingMike Griffithshttp://www.blogger.com/profile/09355113888181272959noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-21052732.post-4674141091682660682018-11-24T02:41:39.107-08:002018-11-24T02:41:39.107-08:00Hi Anonymous, this was not intended as a stand alo...Hi Anonymous, this was not intended as a stand alone "how to" post but was supposed to be an extended comment on the raganwald post (linked above).<br /><br />A stack structure is often used to help evaluate things like numeric expressions that include brackets and (of course) arithmetic operators with varied precedence. [You multiply or divide before adding or subtracting.] Brackets are resolved by pushing left hand brackets onto the stack to be followed by any enclosed arithmetic expressions. Once a right hand bracket turns up then the expression on the stack running back to the left hand bracket is evaluated. The left hand bracket is "popped" from the stack and the result of the arithmetic expression between the brackets pushed back onto the stack in it's place.<br /><br />The little function in my post does the same sort of thing but without any arithmetical terms. It simply pushes left hand brackets (of all types) onto the stack as they are found in the original string. When a right hand bracket turns up any matching left hand bracket on the stack is popped off. At the end of the process, if the stack has one or more left hand bracket left then the string contains unmatched brackets.Mike Griffithshttps://www.blogger.com/profile/09355113888181272959noreply@blogger.comtag:blogger.com,1999:blog-21052732.post-18621690132980184422018-11-23T18:52:55.595-08:002018-11-23T18:52:55.595-08:00I do trust all of the ideas you've presented o...I do trust all of the ideas you've presented on your post.<br /><br />They're really convincing and can definitely work.<br />Nonetheless, the posts are too quick for <br />newbies. Could you please lengthen them a bit from next time?<br />Thanks for the post.Anonymousnoreply@blogger.com