Re: PEG tutorial example doesnt work

Tomas Volf <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <Zrqc2S7skODl0wY9@ws>
Hello,

On 2024-08-11 21:52:42 -0500, Diego Antonio Rosario Palomino wrote:
> Hello, i am a new scheme user trying to exploit the peg library but have
> encountered the following error :
>
> guile c.scm
> ;;; note: source file /home/diego/Documents/Guile/c.scm
> ;;;       newer than compiled
> /home/diego/.cache/guile/ccache/3.0-LE-8-4.6/home/diego/Documents/Guile/c.scm.go
> ;;; note: auto-compilation is enabled, set GUILEAUTO_COMPILE=0
> ;;;       or pass the --no-auto-compile argument to disable.
> ;;; compiling /home/diego/Documents/Guile/c.scm
> ;;; /home/diego/Documents/Guile/c.scm:20:57: warning: possibly unbound
> variable `⇒'
> ;;; compiled
> /home/diego/.cache/guile/ccache/3.0-LE-8-4.6/home/diego/Documents/Guile/c.scm.go
> Backtrace:
> In ice-9/boot-9.scm:
>   1752:10  6 (with-exception-handler   #:unwind?  # )
> In unknown file:
>            5 (apply-smob/0 #<thunk 7fcf881b52a0>)
> In ice-9/boot-9.scm:
>     724:2  4 (call-with-prompt   #<procedure default-prompt-handle…>)
> In ice-9/eval.scm:
>     619:8  3 ( #(#(#<directory (guile-user) 7fcf881b9c80>)))
> In ice-9/boot-9.scm:
>    2836:4  2 (save-module-excursion )
>   4388:12  1 ()
> In /home/diego/Documents/Guile/c.scm:
>     20:57  0 (_)
>
> /home/diego/Documents/Guile/c.scm:20:57: Unbound variable: ⇒

The arrow character in the documentation is a stand in meaning that A returns
B.

So in this example:

    (match-pattern cfunc "int square(int a) { return a*a;}") ⇒
    (32
     (cfunc (ctype "int")
            (cname "square")
            (cargs (carg (ctype "int") (cname "a")))
            (cbody (cstatement "return a*a"))))

It means that

    (match-pattern cfunc "int square(int a) { return a*a;}")

Returns this value:

    (32
     (cfunc (ctype "int")
            (cname "square")
            (cargs (carg (ctype "int") (cname "a")))
            (cbody (cstatement "return a*a"))))

This is used fairly commonly across Scheme info pages, so it is good thing to
know.

Hope this helps,
Tomas

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAma6nNkACgkQL7/ufbZ/
waljqA/+ICXdGFKe3m32RBqJ7NEmlpE2kckWM4FwsEOFW/xHd40oabEr7QqwDwsY
Vd0V1Wg7V1K7a267P9WsokJYJL8+hJWFMiBY8gAziypqpMH6MdLrQOSi/6yIs6ax
GbylzGwTV81t1ITIUoi48aA5cJtYvo1SWhqd7yhFkhhhIm6t/+5dsz54rVbMV3Fg
IUvn9ycdEjIIN/x6zRPWvgPhbeZXL4oxkm+9RFN3KJFi30nHzPo7J+9yb5Lm/qSv
W4vwq28hmi2rbIlaVWuFUQW039EFwpHK9bNdQTQdsNFmxFlQK34NEgSzEdMnAYKD
vuOsthPczccQaZgn7vkzEIXahQDywsEU9RIBEeV91/E0ViYtGPRv45FXUQ5xQQxU
gDTQJMKae13nKTxtKV6geN09vQLP/duyqoXCZeVwIAhbFiT4vBSHpO8G6Wy6pKls
w9RKy2wG13tN6z9LhzA1STucZdlyBoMg26pKo7830OABFwmG+af8kKbeHcDPSMLj
848qDVDDlpN03ywJpEgchuUsKh3uhLxpY949r2xPcgZ+kTPa0O4VGFniei49rZvo
UE93MtBijAlzOJnj39VVj3+0w/CVm4TGpNZjqW/NedAKoqXK/vK/W6B5rmGQNWYX
1D78F5KIZiK8jIpKrrhlfEke3X7a72P0sDEu3Zs4F6TXFjb+/Ck=
=Npnz
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.