Page 1 of 1

Good tools for tidy and lint newlisp code

PostPosted: Sun Jul 24, 2016 7:52 am
by ssqq
I re-design these two tools now:

tidy newlisp:
could find loss ")" or more ")". while, letn, dotimes all indent two space.

https://github.com/songzan/newlisp-spp/ ... s/lint.lsp

usage: > newlisp tidy.lsp target.lsp

lint nelisp:
could check un-declare symbol and un-used symbol.

https://github.com/songzan/newlisp-spp/ ... s/lint.lsp

usage: newlisp lint.lsp target.lsp

or you could puts them in your bin path:

Code: Select all
newlisp -x lint.lsp lint
chmod 755 lint
sudo mv lint /usr/bin/lint
newlisp -x tidy.lsp tidy
chmod 755 tidy
sudo mv tidy /usr/bin/tidy

Re: Good tools for tidy and lint newlisp code

PostPosted: Sat Jul 30, 2016 7:14 am
by ssqq
When we use newlisp write code, the interpreter could not do anything for us. Because newLISP must be rapidly, more and more.

So, we could do something for to more stable code:

1. un-used symbol:

Code: Select all
(define (foo x y) (+ x 1))


below code, symbol 'y' have not used, It's may not any dangrous. but:

Code: Select all
(define (foo x) (+ x y))

If we use an un-declare symbol, may be occure some accident.

If we could not find below error, may enlarge error:

Code: Select all
(define (foo x) (set 'y 10) (+ x y))

Now, all function in current Context would see this symbol, if you use this symbol, the value
may not be control by you.

all of it could not be find by newLISP interpreter, but Lint.lsp could do it.

> newlisp lint.lsp target.lsp
or you could compiler it in first.
> lint target.lsp