Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'debug': 0.05; 'debugging': 0.05; 'lines.': 0.07; 'only,': 0.07; 'parser': 0.07; 'subject:How': 0.09; 'python': 0.09; 'lawrence': 0.09; 'parsers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:language': 0.09; 'language,': 0.11; 'resulting': 0.13; 'yet.': 0.13; 'breakpoints': 0.16; 'executable,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'scripts.': 0.16; 'subject:parser': 0.16; 'wrote:': 0.17; 'detect': 0.17; 'module,': 0.17; 'appears': 0.18; 'module': 0.19; 'mostly': 0.20; 'written': 0.20; 'trying': 0.21; 'programming': 0.23; 'script': 0.24; 'allows': 0.25; 'pass': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.28; 'lines': 0.28; 'statements': 0.29; 'subject: ?': 0.30; 'distribute': 0.30; 'code': 0.31; 'from:addr:yahoo.co.uk': 0.32; 'could': 0.32; 'to:addr:python- list': 0.33; 'languages': 0.33; 'there': 0.35; 'received:org': 0.36; 'flow': 0.36; 'client': 0.36; 'thank': 0.36; 'too': 0.36; 'enough': 0.36; 'itself': 0.37; 'ones': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'files': 0.38; 'possible.': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'most': 0.61; 'real': 0.61; 'subject': 0.66; 'subject:write': 0.84; 'timothy': 0.84; 'understand,': 0.84; 'conflicts,': 0.91; 'hundred': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: How to write a language parser ? Date: Sat, 23 Feb 2013 02:14:37 +0000 References: <51279cfe$0$293$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-22-84-96.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 In-Reply-To: <51279cfe$0$293$14726298@news.sunsite.dk> X-Antivirus: avast! (VPS 130222-1, 22/02/2013), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361585689 news.xs4all.nl 6968 [2001:888:2000:d::a6]:47597 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39642 On 22/02/2013 16:29, Timothy Madden wrote: > Hello > > I am trying to write a DBGp client in python, to be used for debugging > mostly php scripts. > > Currently the XDebug module for php allows me to set breakpoints on any > line, include blank ones and lines that are not considered executable, > resulting in breakpoints that will never be hit, even if program flow > control appears to pass through the lines. > > For that I would like to write a php parser, in order to detect the > proper breakpoints line for statements spanning multiple lines. > > Is there an (open-source) way to do to this in python code ? Most > parsers I could see after a search are either too simple for a real > programming language, or based on a python module written in C. My debug > client is a Vim plugin, and I would like to distribute it as script > files only, if that is possible. The generator itself my well be a C > module, as I only distribute the generated output. > > The best parser I could find is PLY, and I would like to know if it is > good enough for the job. My attempt at a bison parser (C only) ended in > about a hundred conflicts, most of which are difficult to understand, > although I admit I do not know much about the subject yet. > > Are there other parsers you have used for complete languages ? > > Thank you, > Timothy Madden http://nedbatchelder.com/text/python-parsers.html -- Cheers. Mark Lawrence