Hey Ivan, Thanks for the reply!
Can't find calc_silex.scm in http://chicken.kitten-technologies.co.uk/cache/5/lalr/2.5.1/ Am I looking in the wrong place? From: Ivan Raikov <[email protected]> Sent: Thursday, June 6, 2019 4:41 PM To: Joe Anonimist Cc: [email protected] 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 <[email protected]> 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: > > http://compgroups.net/comp.lang.scheme/a-quick-getting-started-example-with-silex-l/1183462 > > (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 > [email protected] > https://lists.nongnu.org/mailman/listinfo/chicken-users _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
