From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Libre-RISCV General Development <libre-riscv-dev@lists.libre-riscv.org>
Subject: [libre-riscv-dev] GardenSnake.py
Date: Sun, 29 Mar 2020 10:40:31 +0000
Message-ID: <CAPweEDy0Ds=iik3nxtO1HdoGyt9c4SeysYFDrdqqo-65_7UtdQ@mail.gmail.com> (raw)
i love python-ply. i love that it does embedded BNF in
comment-strings, and a lot more.
GardenSnake.py was an example of a python code-parser written *in*
python to parse a very small subset *of* python, using python-ply.
the problem is: ply is designed as a LALR parser (and yacc lexer),
where python is a *whitespace* language that completely fails to fit
standard LALR.
it therefore needed a special parser, which worked for a short
duration of time until some internal changes in ply caused it to
break. i spent this morning getting it working, and the example
succeeds! w00t!
however that's not why i'm writing (although it's cool) - it's because
these files:
https://libre-riscv.org/openpower/isa/stringldst/
all need a *whitespace* (indentation) parser in order to be able to read them.
ah.
the actual "language" is even more basic than python, however if we're
to accelerate things - and stand a chance of getting them right
without laborious checking - we need to be able to parse these
pseudo-code fragments and get them into python (and later nmigen).
so i am currently attempting to add "else" support to GardenSnake.py,
then "while", and after that it should be pretty straightforward to
convert to the power pseudo-code.
l.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
next reply index
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-29 10:40 Luke Kenneth Casson Leighton [this message]
2020-03-29 11:35 ` Luke Kenneth Casson Leighton
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPweEDy0Ds=iik3nxtO1HdoGyt9c4SeysYFDrdqqo-65_7UtdQ@mail.gmail.com' \
--to=lkcl@lkcl.net \
--cc=libre-riscv-dev@lists.libre-riscv.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
Libre RISC-V Mailing list Archives (accessible via public-inbox)
Archives are clonable: git clone --mirror https://inbox.libre-soc.org/libre-riscv-dev
Example config snippet for mirrors
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git