Re: parser using perl



On Mon, Mar 31, 2008 at 10:36 AM, Sharan Basappa
<sharan.basappa@xxxxxxxxx> wrote:
Hi,

I am trying to extract information from a file that follows the syntax
of a high level language (something like C++)
The script just needs to understand a very minuscule portion of this
language to do this. It does not have to
know the complete high level language. I just wanted to know any
modules are available within perl that makes
this job easier. I feel it is possible to do the complete work in
perl, but I might be wrong. Especially around the
recursion that languages support. The other option I have is to use a
public domain parser like Bison and parse
the input, build some data structure that perl can lookup and do the processing.

I would like to know experience of people on this forum ...

Regards


Take a look at Parse::RecDescent*. In general, it doesn't matter if
you want to work with a small piece of a language or the whole
language, you still need to implement a parser for the whole language.
You can get an eighty or ninety percent solution without a full
parser, but there will always be problems.

* http://search.cpan.org/dist/Parse-RecDescent/lib/Parse/RecDescent.pm

--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
.



Relevant Pages

  • Re: Python or PHP?
    ... > every language here and there more ways to do something. ... The best the programmer can do, as you imply, is to ... parse out into proper perl expressions. ... > lists, dictionaries, etc. etc. ...
    (comp.lang.python)
  • Re: Native language versions
    ... It is a different language which can be translated ... into perl and can use Perl modules. ... away quite a bit from the OP's notion of just translating perl keywords ... There's probably not much use for a user-accessible programming language ...
    (comp.lang.perl.misc)
  • Re: Wondering if you guys would like to comment on this
    ... >>ever tried using someone's highly customized EMACS setup? ... I've had the same experience with perl that he ... problem with any programming language, perl tends to make it worse ... I have the same rules on LISP programming that I do with perl ...
    (comp.lang.lisp)
  • Recommend an E-book Meeting the Following Criteria (Newbie, Long)
    ... I know several programming languages namely Java, Perl and C in this order ... Now I'm wondering which Python book I should get as there are so many out ... I'd like to mostly concentrate on language features but some pointers ...
    (comp.lang.python)
  • Re: Why I never got into Lisp
    ... solutions in languages like Perl. ... and what you tried in Lisp, and how Lisp mapped better, for you. ... While this can be done to some extent in any language, ... liked the fact that Ruby, like lisp, seems to have sensible defaults ...
    (comp.lang.lisp)