guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: style Q: use keywords for my LALR parser generator?


From: Thien-Thi Nguyen
Subject: Re: style Q: use keywords for my LALR parser generator?
Date: Mon, 29 Dec 2014 16:43:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

() Matt Wette <address@hidden>
() Mon, 29 Dec 2014 06:05:35 -0800

   (define (non-terminal? term tokl)
     (and (symbol? term) (not (memq term tokl))))

If ‘tokl’ contains only symbols, then the first sub-expression
‘(symbol? term)’ is superfluous, thanks to ‘memq’.

   (define (non-terminal? term)
     (symbol? term))

How about using an object property?

 (define terminal (make-object-property))
 
 (define (non-terminal? obj)
   (not (terminal obj)))

You would have to ‘(set! (terminal OBJ) #t)’ for every terminal,
of course.  This works fine w/ either symbols or keywords, btw.

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]