altoviso / bdParse

a JavaScript LL(1) parser in JavaScript
http://bdframework.org/bdParse/index.html
Other
14 stars 3 forks source link

possibility of using bdParse to implement a lint checker? #1

Open liucougar opened 13 years ago

liucougar commented 13 years ago

is it possible to use bdParse as the basis for implementing a lint checker (like jslinter) with extensible checkers?

does the tokenizer keep track of all the white spaces and other formattings of the source code?

thanks

rcgill commented 13 years ago

Yes, absolutely could be used for a lint checker...and that's where we're going with some of these projects.

The tokenizer keeps track of ws indirectly. Unlike most (all?) parsers, it keeps the comment tokens in the token stream. That means ws can be determined by looking at the end-to-start (line, col) of two adjacent tokens.

It also means that semantic comment systems can be constructed. For example,

function circleArea( r //(int) the radius ) { // computes the area of a circle with radius r ...

Could be pushed through bdParse and with the appropriate recipe to understand that the comments apply to particular definitions, a large improvement over the noisy jsdoc style.

If you decide to start building something, by all means ping me...I'll watch.

Best, Rawld

liucougar commented 13 years ago

thanks for the info. I will try to come up with a framework with some minimal checkers and will ping you when I have something for you to watch

btw: how do I setup my nodejs to use bdParse? is there some documentation on that?

rcgill commented 13 years ago

re setup for nodejs: you can look at bdBuild which uses bdLoad to load bdParse; I'll get simple, standalone demo to you in the next day or so.

rcgill commented 13 years ago

Hi liucougar!

I've added a demo to show you how to use bdParse with node. Look at the first demo mentioned at http://bdframework.org/bdParse/demos.html .

Let me know how it goes!

liucougar commented 13 years ago

thanks for the info. Will give it a shot and let you know.