From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a99d429b9f3a6dcc,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 X-Received: by 10.224.217.7 with SMTP id hk7mr1122105qab.7.1363853086303; Thu, 21 Mar 2013 01:04:46 -0700 (PDT) X-Received: by 10.49.3.42 with SMTP id 10mr891190qez.23.1363853086271; Thu, 21 Mar 2013 01:04:46 -0700 (PDT) Path: k8ni5855qas.0!nntp.google.com!dd2no4859682qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 21 Mar 2013 01:04:46 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=136.163.203.9; posting-account=ytJKAgoAAAA1tg4ScoRszebXiIldA5vg NNTP-Posting-Host: 136.163.203.9 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Stack Overflow when Pyparsing Ada 2005 Scoped Identifiers using Reference Manual Grammar From: per.nordlow@gmail.com Injection-Date: Thu, 21 Mar 2013 08:04:46 +0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Date: 2013-03-21T01:04:46-07:00 List-Id: I'm currently implementing an Ada 2005 parser using Pyparsing and the refer= ence manual grammar rules. We need this in order to analyze and transform p= arts of our aging Ada-codebase to C/C++. Most things work. However, one little annoying problem remains: The grammar rule name when parsing scoped identifiers (rule selected_compon= ent) such as the expression "Global_Types.Integer2" fails because it is par= t of a left-associative grammar rule cycle. Pyparsing infinite recursion and Python spits out maximum recursion depth e= xceeded. I believe the problem is caused either by the fact that =95the associativity of the grammar rule selected_component is right-to-lef= t. I've search the reference manual of Pyparsing but haven't found anything= relevant. Should we treat dot (.) as an operator with right-to-left associ= ativity or can we solve it throught extensions and restructurings of the gr= ammar rules? =95or by the fact that there is no check in Pyparsing infinite recursions. = I believe this wouldn't be too hard to implement. Use a map from currently = active rules (functions) to source position/offset (getTokensEndLoc()) and = always fail a rule if the current source input position/offset equals the p= osition related to the rule just entered. The problem also seems closely related to "Need help in parsing part of python grammar": http://pyparsing.wikispaces.= com/message/view/home/51617848 which unfortunately doesn't have answers yet. Also see this thread http://stackoverflow.com/questions/15438015/stack-overflow-when-pyparsing-a= da-2005-scoped-identifiers-using-reference-manual?noredirect=3D1#comment220= 14663_15438015 Thanks in advance, Per Nordl=F6w