Thien-Thi Nguyen wrote:
Tom Hawkins <[EMAIL PROTECTED]> writes:

   All comments are welcome.

disclaimer: i like parentheses.

maybe it would be better to use simple paired-one-character delimiters
(like parens, or {} or []) and prefix operators for structure, so that
the question of how to parse a properly nested form is already answered.

what lies inside those forms is where the design effort (for a new
format) really ought to focus, IMHO.  for structure, combination of
curly braces plus "begin/end"-style blocks plus infix notation means
another few months playing w/ (and debugging) lex/yacc or dedicated
parsing library only to discover underspecification later which results
in another few years of retrograde hacking or another few layers of
compensating syntax (followed by retrograde hacking anyway).

you can say "human -readable -editable -friendly", etc. all you want,
but as a human who writes programs w/ parentheses, i must say i would
find this:

(:scope "top" "top"
  (:input "clock" 1 ( 6 ))
  (:input "a" 8 ( 0 ))
  (:input "b" 8 ( 1 ))
  (:scope "register" "reg_a"
    :ff 8 ( 2 6 0 )
    :name "reg_val" 8 ( 2 ))
  (:scope "register" "reg_b"
    :ff 8 ( 3 6 1 )
    :name "reg_val" 8 ( 3 ))
  (:add 8 ( 4 2 3 ))
  (:scope "register" "reg_c"
    :ff 8 ( 5 6 4 )
    :name "reg_val" 8 ( 5 ))
  (:output "c" 8 ( 5 )))

Sure, I don't mind parentheses. I'm not a LISP/emacs expert -- what is the colon for, such as (:scope ...). Why not just (add 8 ...)


Also, how should lists of numbers be distinguished from functions?

  '(2 6 0)  or (quote (2 6 0))

Thanks for the suggestions.

-Tom


a much better (more friendly) starting point than the example it was
modified from (taken from the webpage). why? because i can put this in
an emacs buffer, type:


M-x emacs-lisp-mode RET     ;; for syntax highlighting (eye candy)
M-<                         ;; to go to beginning of buffer
M-: (setq play (read (current-buffer))) RET

and now i have just parsed the entire form into the variable `play' at
which point further editing, validation and modification of the form is
but a SMOP.  i am free to concentrate on the meaning of the form thanks
to its extremely regular syntax.  bottom line: i am ahead of the game
from those who have to find/build/install (on which platforms?!, w/ what
dependencies?!, etc.etc) a dedicated parser or parser library.

anyway, best of luck in your design efforts!

thi





Reply via email to