Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

Making a javascript parser in javascript language

Hi,
I need to make a javascript code which will parse a javascript file and tell me whether this is a valid javascript program or not. Are there any tools or libraries available to do so ?
Also i guess eval() function can be used to do it. But it could be dangerous as i have read on some websites...
I am bascially planning to embed the javascript parser on my web application and so whatever code the users puts in there my parser will parse it and tell whether its a valid javascript file or not.
Please provide some tips... A parser may not be even required probably if i could use eval statement ... or something similar. It will do the job out of the box without writing anything.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Michael Vasilevsky
Michael Vasilevsky
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rohit Bajaj

ASKER

This seems good, I need some comments about using eval for this purpose. Although i think it wont exactly fit there. But there might be an alternative.
The reason is i dont have to include and separate library in my code if this approach succeeds thereby lowering the page load time.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial