emacs-devel
[Top][All Lists]
Advanced

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

Re: SMIE examples and questions


From: Aurélien Aptel
Subject: Re: SMIE examples and questions
Date: Fri, 31 Jul 2020 16:42:40 +0200

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 via email to

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