unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Aurélien Aptel" <aurelien.aptel@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: SMIE examples and questions
Date: Fri, 31 Jul 2020 16:42:40 +0200	[thread overview]
Message-ID: <CA+5B0FOyDofKWhJypRSxOL=+8tAKwWdF2P=dka+byXrLhHFCig@mail.gmail.com> (raw)
In-Reply-To: <jwvh7uz3xkk.fsf-monnier+emacs@gnu.org>

The language is Poke. It is C-like.
The main thing are (possibly anonymous) structure like so:

    struct
    {
      int32_t foo;
      int8_t bar;
    };

Some expressions can be embedded in the type, and there is a binding
system similar to typedef where you can do:

    deftype foo = struct {...}; devar bar = 42;

Sample source: https://git.savannah.gnu.org/cgit/poke.git/tree/pickles/elf.pk
There's an ANTLRv4 grammar here:
https://git.savannah.gnu.org/cgit/poke.git/tree/etc/poke.g4

So far I only have the font-locking...
https://git.savannah.gnu.org/cgit/poke.git/tree/etc/poke-mode.el
And this anemic grammar:

(defvar poke-smie-grammar
  (smie-prec2->grammar
   (smie-bnf->prec2
    '((id)
      (def ("defvar" id "=" inst)
       ("deftype" id "=" inst))
      ;; (exp (exp "+" exp)
      ;;        (exp "-" exp)
      ;;        (exp "*" exp)
      ;;        (exp "==" exp)
      ;;        (exp "!=" exp)
      ;;        (exp "<" exp)
      ;;        (exp "<=" exp)
      ;;        (exp ">" exp)
      ;;        (exp ">=" exp)
      ;;        ("(" exp ")"))
      (inst ("struct" insts)
        ("union" insts)
        (id id))
      (insts (insts ";" insts) (inst))))))



      reply	other threads:[~2020-07-31 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25  9:21 SMIE examples and questions Aurélien Aptel
2020-06-25 16:54 ` Stefan Monnier
2020-07-31 14:42   ` Aurélien Aptel [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/emacs/

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

  git send-email \
    --in-reply-to='CA+5B0FOyDofKWhJypRSxOL=+8tAKwWdF2P=dka+byXrLhHFCig@mail.gmail.com' \
    --to=aurelien.aptel@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).