Questions tagged [sly]

This tag is for the Python parser generator Sly, a proposed redesign by the same author of the Ply parser. On October 11, 2022, the author indicated that Sly has been retired and work on it will not continue, although the github repository will be maintained. Do not use this tag for questions related to the Emacs Lisp IDE with the same name. For those, use the emacs tag or post on http://emacs.stackexchange.com.

Sly was a LALR(1) parser generator written in Python by David Beazley, creator of the Ply parser generator, which Sly was intended to replace. On October 11, 2022, Beazley officially retired Sly, although he indicated that the Github repository will continue to exist. The version on that repository requires Python v3.6 or above.

Documentation was kept on Read the Docs, but it was not updated to reflect the last changes to Sly.

It is important that questions identify the version number (sly.__version__) or the Github repository date of the Sly installation.

20 questions
0
votes
1 answer

Sly parsing of multiple statements where all but the last one must be terminated with a Newline

I have a scripting language that I am implementing where every statement is terminated by a newline, except possibly the last one. It's also possible to have lines that are just newlines. Here's one implementation (statement code omitted since it…
Sean Duggan
  • 1,105
  • 2
  • 18
  • 48
0
votes
2 answers

Read patterns Simple DSL using Python SLY

I try to create simple DSL with Python SLY . But, I can't get the result as I expected because the parser can't read it properly. So here the code : Lexer from sly import Lexer class ConfigLexer(Lexer): tokens = { ANIMALS, BLOOD, SKIN, BREATHE,…
0
votes
1 answer

sdl2:load-bmp Problem with current working directory, common-lisp

While trying to work through cl-sdl2-tutorial, I'm having trouble loading a bitmap due to a wrong current working directory. I'd like to get a proper solution to the problem using relative path names. A minimal working example: Having modified the…
jue
  • 435
  • 5
  • 7
0
votes
0 answers

Confusing syntax: either a pylint warning, or a program error using the "sly" lexer

I am using the sly lexer to build a simple lexer, and I am a little confused by the Python syntax in this one. The below code works, but I get a syntax warning in my editor, that I am using OPCODE before assignment. from sly import Lexer class…
Bart Friederichs
  • 33,050
  • 15
  • 95
  • 195
-1
votes
1 answer

Can I establish a reference variable that will then let me assign a new value?

I'm writing a script interpreter in Python using Sly. While figuring out how to best write assignment interpretation, I found myself unable to quite understand how to handle the left-hand side being different sorts of values. The scripting language…
Sean Duggan
  • 1,105
  • 2
  • 18
  • 48
1
2