[Top][All Lists]

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

Re: [Chicken-users] Silex & Lalr example wanted

From: Joe Anonimist
Subject: Re: [Chicken-users] Silex & Lalr example wanted
Date: Thu, 6 Jun 2019 18:55:00 +0000

Hey Ivan,

Thanks for the reply!

Can't find calc_silex.scm in

Am I looking in the wrong place?

From: Ivan Raikov <address@hidden>
Sent: Thursday, June 6, 2019 4:41 PM
To: Joe Anonimist
Cc: address@hidden
Subject: Re: [Chicken-users] Silex & Lalr example wanted
Hi Joe,

I have added an example use of lalr with silex in the lalr repository
(file calc_silex.scm). Briefly, this is the pattern I use:

(define-syntax tok
  (syntax-rules ()
    ((tok loc t) (make-lexical-token (quasiquote t) loc #f))
    ((tok loc t l) (make-lexical-token (quasiquote t) loc l))))

;; parser
(include "calc.yy.scm")
;; lexer
(include "calc.l.scm")

(define lexer-error error)

(lexer-init 'port (current-input-port))
 (calc-parser lexer error))

Let me know if you are still having trouble. Best regards,

Ivan Raikov

On Thu, Jun 6, 2019 at 2:10 AM Joe Anonimist <address@hidden> wrote:
> (newbie)
> Hi all,
> I am trying to figure out how Silex and Lalr work together.
> The "official" lalr example works but I can't figure out
> how to make it work with Silex. The only example I was able
> to find online is here:
> (apparently posted by another newbie, who actually managed
> to make it work)
> but when I follow the steps from the example
> I get the following error:
> Error: call of non-procedure: (lr-driver (quote #(((*default* *error*) (ID 
> 1)) ((*default* -8)) ((*default* -7)) ((*default* -4)
> ...
>         Call history:
>         <eval>    [apply-hooks306] (loop (cdr l))
>         <eval>    [apply-hooks306] (cdr l)
>         <eval>    [apply-hooks306] (pair? l)
>         <eval>    [lexer-init] (lexer-get-func-line IS)
>         <eval>    [lexer-get-func-line] (cdr (assq (quote get-user-line) IS))
>         <eval>    [lexer-get-func-line] (assq (quote get-user-line) IS)
>         <eval>    [lexer-init] (lexer-get-func-getc IS)
>         <eval>    [lexer-get-func-getc] (cdr (assq (quote user-getc) IS))
>         <eval>    [lexer-get-func-getc] (assq (quote user-getc) IS)
>         <eval>    [lexer-init] (lexer-get-func-ungetc IS)
>         <eval>    [lexer-get-func-ungetc] (cdr (assq (quote user-ungetc) IS))
>         <eval>    [lexer-get-func-ungetc] (assq (quote user-ungetc) IS)
>         <syntax>          (print (expr-parser lexer print))
>         <syntax>          (expr-parser lexer print)
>         <eval>    (print (expr-parser lexer print))
>         <eval>    (expr-parser lexer print)     <--
> So I would appreciate any examples of a simple
> "calculator" lexer-parser with Silex/Lalr
> or any pointers how to make them work together.
> _______________________________________________
> Chicken-users mailing list
> address@hidden

reply via email to

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