guile-user
[Top][All Lists]
Advanced

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

Re: Nyacc patches for Mes to avoid bundling?


From: Matt Wette
Subject: Re: Nyacc patches for Mes to avoid bundling?
Date: Sat, 6 May 2017 08:21:12 -0700

> On May 5, 2017, at 3:59 PM, Matt Wette <address@hidden> wrote:
> 
> 
>> On May 5, 2017, at 6:33 AM, Jan Nieuwenhuizen <address@hidden> wrote:
>> 
>> Matt Wette writes:
>> 
>>> I see that you have PEG parser.  You could use that to implement regexps I 
>>> believe. 
>> 
>> That's an interesting suggestion...however PEG is currently terribly
>> slow with Mes.  I added it before adding Nyacc to give me the option
>> to write the C parser in.
> 
> Fine.  The tiny bit of code I use regexp for can be done easily with a finite 
> state machine and charsets.
> 

Split-cppdef is now sing just string functions:

(define (split-cppdef defstr)
  (let ((x2st (string-index defstr #\()) ; start of args
        (x2nd (string-index defstr #\))) ; end of args
        (x3 (string-index defstr #\=)))  ; start of replacement
    (cond
     ((not x3) #f)
     ((and x2st x3)
      ;;(if (not (eq? (1+ x2nd) x3)) (c99-err "bad CPP def: ~S" defstr))
      (cons* (substring defstr 0 x2st)
             (string-split
              (string-delete #\space (substring defstr (1+ x2st) x2nd))
              #\,)
             (substring defstr (1+ x3))))
     (else
      (cons (substring defstr 0 x3) (substring defstr (1+ x3)))))))


And with regard to your name clashes I have added prefixes.  Here is the call 
to generate the table and action files:

  (write-lalr-actions c99-mach (xtra-dir "c99act.scm.new") #:prefix "c99-")
  (write-lalr-tables c99-mach (xtra-dir "c99tab.scm.new") #:prefix "c99-“)


These should show up in the first nyacc release after 0.77.0.

Matt




reply via email to

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