Ask a Question related to PERL Modules, Design and Development.
-
Irving Kimura #1
Help: Need to roll my own JS parser
I need a JavaScript parser. A search through CPAN didn't turn up
anything (please correct me if I'm wrong!), so it looks like I'll
have to roll my own. Are there any generic modules that could I
use to make the task of writing a computer language parser somewhat
easier?
Thanks!
-Irv
Irving Kimura Guest
-
w3d roll over problem
hi, my one project wich have one w3d file having 10 model and i want to display that model name when mouse over the model and that model's shader... -
Roll out
I have noticed on a few flash sites that when i click on a button the stage 'rolls out' and the transition between one stage and the next is nice... -
roll over questions
I just started using director 10 days ago and my brain is ready to snap. I'm building a very simple interactive CD for my furniture business and am... -
HTML-Parser / SGML-Parser
Ok, silly question. I am writing a script to determine my router's WAN ip address and then to email me once an hour in case it changes. Currently... -
more than 36 photographs on a roll?
I get 37 to 38 on a 36 exposure roll with my Nikon N70. Ross - Jan Keirse wrote: -
Lenonardo #2
Re: Help: Need to roll my own JS parser
Irving Kimura <irving_kimura@lycos.com> wrote in news:bgo8a7$e77$1
@reader1.panix.com:
There is Javascript.pm (by Claes Jacobsson I think).> I need a JavaScript parser. A search through CPAN didn't turn up
> anything (please correct me if I'm wrong!), so it looks like I'll
> have to roll my own. Are there any generic modules that could I
> use to make the task of writing a computer language parser somewhat
> easier?
>
> Thanks!
>
> -Irv
>
This allows embedding of Javascript into perl modules through interface to
libjs from Mozilla.
Claes gave a talk on this at the YAPC in Paris - so there may be some
additional info in his slides etc.
Lenonardo Guest
-
Irving Kimura #3
Re: Help: Need to roll my own JS parser
In <Xns93CE9BC8C930M3141T@193.38.113.46> Lenonardo <leonardo@duckpond.co.uk> writes:
>Irving Kimura <irving_kimura@lycos.com> wrote in news:bgo8a7$e77$1
>@reader1.panix.com:>> I need a JavaScript parser. A search through CPAN didn't turn up
>> anything (please correct me if I'm wrong!), so it looks like I'll
>> have to roll my own. Are there any generic modules that could I
>> use to make the task of writing a computer language parser somewhat
>> easier?
>>
>> Thanks!
>>
>> -Irv
>>I'm not sure I understand your suggestion. How would Javascript.pm>There is Javascript.pm (by Claes Jacobsson I think).
>This allows embedding of Javascript into perl modules through interface to
>libjs from Mozilla.
provide (or help me build) a parser for JavaScript?
-Irv
Irving Kimura Guest
-
Lenonardo #4
Re: Help: Need to roll my own JS parser
Ah - I was assuming you only wanted to parse the Javascript in order to
run it.
Javascript.pm allows you to load javascript code and execute it (i.e.
call javascript from perl) - and also call perl from javascript.
If you want to parse Javascript so that you end up with a language tree
or whatever then I don't know of anything - but libjs might provide such
a method.
Irving Kimura <irving_kimura@lycos.com> wrote in
news:bgopk3$kso$1@reader1.panix.com:
> In <Xns93CE9BC8C930M3141T@193.38.113.46> Lenonardo
> <leonardo@duckpond.co.uk> writes:
>>>>Irving Kimura <irving_kimura@lycos.com> wrote in news:bgo8a7$e77$1
>>@reader1.panix.com:>>>> I need a JavaScript parser. A search through CPAN didn't turn up
>>> anything (please correct me if I'm wrong!), so it looks like I'll
>>> have to roll my own. Are there any generic modules that could I
>>> use to make the task of writing a computer language parser somewhat
>>> easier?
>>>
>>> Thanks!
>>>
>>> -Irv
>>>>>>There is Javascript.pm (by Claes Jacobsson I think).
>>This allows embedding of Javascript into perl modules through
>>interface to libjs from Mozilla.
> I'm not sure I understand your suggestion. How would Javascript.pm
> provide (or help me build) a parser for JavaScript?
>
> -Irv
>Lenonardo Guest
-
pkent #5
Re: Help: Need to roll my own JS parser
In article <bgo8a7$e77$1@reader1.panix.com>,
Irving Kimura <irving_kimura@lycos.com> wrote:
As you want to parse JS yourself (rather than simply use it, which the> I need a JavaScript parser. A search through CPAN didn't turn up
> anything (please correct me if I'm wrong!), so it looks like I'll
> have to roll my own. Are there any generic modules that could I
> use to make the task of writing a computer language parser somewhat
> easier?
excellent Javascript.pm is more for, as suggested elsewhere on this
thread) you'll need a definition of the language. Once you've got that
you can decide how you want to implement the parser, and indeed whether
you want to somehow do something with the parsed code.
At one extreme you can implement the parser by reading a character from
somewhere, and then reading another and another, and so on... all the
time maintaining various state flags (such as 'in a comment', 'in a
string', 'in a string but just got a backslash escape', 'expecting an
alphabetic character or end of string' etc).
At the other extreme, and certainly the route I'd recommend is to use
something like the excellent Parse::Yapp. Basically you create a file
that tells yapp how your syntax is logically built up, and you write a
tokenizer, and yapp does the rest. I've used it to successfully build a
parser for arbitrary expressions (such as
foo.bar + (12.3 - foo('%s!', (w*2))) / baz
See:
[url]http://search.cpan.org/author/FDESAR/Parse-Yapp-1.05/[/url]
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
pkent Guest
-
Horacio Spinelli on FB #6
Re: Help: Need to roll my own JS parser
That tokenizer approach that that person mentioned using Parse::Yapp is god. I cant believe that exists im about to try to read everything about that module, what i always did was just use regex, which is the approach he gave you before Yapp.
Horacio Spinelli on FB Guest



Reply With Quote

