unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Tomas Volf <~@wolfsden.cz>
To: Diego Antonio Rosario Palomino <diegorosario2013@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: PEG tutorial example doesnt work
Date: Tue, 13 Aug 2024 01:38:01 +0200	[thread overview]
Message-ID: <Zrqc2S7skODl0wY9@ws> (raw)
In-Reply-To: <CAONcbWL5dTU3zDXmH_PmtzWxiebvstcLZJ5xfDSPnFHwvvBO0w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2024-08-12 23:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  2:52 PEG tutorial example doesnt work Diego Antonio Rosario Palomino
2024-08-12 23:38 ` Tomas Volf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zrqc2S7skODl0wY9@ws \
    --to=~@wolfsden.cz \
    --cc=diegorosario2013@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).