Friendlier syntax



Hi everyone

Just had an idea this morning - don't know how good it is tho since
I'm very new to Lisp. Would like to get some feedback:-

So for the context:

I don't know about you, but I think Python's use of whitespace makes
code very pleasing to look at. I'm guessing this is partially why
it's gotten so popular.

Now the idea I'm proposing: I was thinking about this in regards to
Lisp, and I thought, why can't it be represented like that as well?

Example:

test 2
blah 2 3
asdf 3 4 (test 156)
setq blah 3
bleh 15
....

can be translated to sexprs based on whitespace:

(test 2 (blah 2 3) (asdf 3 4 (test 156)) (setq blah 3)) (bleh 15)

From a parsing perspective:
* For every new line, prefix with a ( to create a sexpr.
* If next line has the same level indent, close off sexpr with a ).
* If next line is indented, don't do anything.
* If next line is outdented, add a ), and for each level it is
outdented, add a ).

Interesting Points
* You can still use parentheses, but they've to be on the same line.
* I'm not sure about things like quoting & backquoting sexprs, macros,
etc. But I imagine all potential problems are solvable, if there are
any.

What does everyone think?

.



Relevant Pages

  • Re: Friendlier syntax
    ... but I think Python's use of whitespace makes ... * If next line has the same level indent, ... I'm not sure about things like quoting & backquoting sexprs, macros, ...
    (comp.lang.lisp)
  • Re: Friendlier syntax
    ... but I think Python's use of whitespace makes ... If next line has the same level indent, ... I'm not sure about things like quoting & backquoting sexprs, macros, ...
    (comp.lang.lisp)
  • Re: Lisp at sexps length
    ... > sexprs being a problem for those who have undertaken learning Lisp. ... Well, I'm not expressing my dislike of sexprs loudly here, because it's ... But it's still possible to do that with less parens than ... the matching opening bracket, ...
    (comp.lang.lisp)
  • Re: Why lisp as a web programming language dont get no (mainstream) love
    ... I learned my trade writing Lisp, ... I started using server-side Java as a language to implement Web ... XHTML, and XML on which it is built, are simply SEXPRs. ...
    (comp.lang.lisp)
  • Re: Friendlier syntax
    ... but I think Python's use of whitespace makes ... Lisp, and I thought, why can't it be represented like that as well? ... I'm not sure about things like quoting & backquoting sexprs, macros, ... I also bind a function that calls newline-and-indent and insert- ...
    (comp.lang.lisp)