On Monday 05 December 2005 17:56, John Haxby wrote:
> Yonik Seeley wrote:
> 
> >I looked into this a year ago... most scripting languages have an
> >emphasis on script execution speed, not script parsing speed (which is
> >what we would need).  The scripting languages I tried were horribly
> >slow at parsing a small script.  The only one that could parse at a
> >reasonable speed was rhino (javascript) in interp mode.
> >  
> >
> I've always found the lisp syntax very easy to parse.  In this case, 
> it's just prefix with the nam of he operator being first in the list, eg 
> (and "eggs" "oranges").   There are wrinkles for named and optional 
> parameters, but the basic syntax is a doddle.

Lisp syntax is good at nesting, and it also does properties and roles:

((phrase 5) "eggs" "oranges")

(boolean (must "eggs") (mustnot "oranges"))


I like the simplicity. Now the earlier example:


(boosting
  (match
    ((moreLikeThis (percent "0.25") (docId "44")) 
      (compareField "contents")
      (compareField "title")
    )
  )
  ((downgrade (demote "0.5"))
    ((simple "contents")
      (or "ice hockey" puck rink)
    )
  )
)

The deep nesting is tricky with only one kind of
partentheses/brackets. Perhaps python like is better. Python
has nesting by indentation introduced by a colon at the end
of the previous line.
To be read with a fixed width font:

boosting:
  match:
    moreLikeThis(percent="0.25", docId="44"): 
      compareField("contents")
      compareField("title")
  downgrade(demote="0.5"):
    simple("contents"):
      or:
        "ice hockey"
        puck
        rink


Quite readable, but not so easy to parse.
(One could even do away with the colons.)

Regards,
Paul Elschot


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to