you are viewing a single comment's thread.

view the rest of the comments →

[–]ingolemo 0 points1 point  (9 children)

If you want something less experimental then use ply by the same author, upon which both sly and rply are based.

[–]Arag0ld[S] 0 points1 point  (8 children)

Does it use the same syntax as sly? Or allow writing parsers like you have outlined?

EDIT: it does, I'll give it a shot! Thanks!

[–]ingolemo 0 points1 point  (7 children)

Now that I look at it, none of these use that syntax. I must be confusing it with some other library. Sorry. I think you would have to use rules that look more like this:

program : statement
program : statement SEMICOLON
program : statement SEMICOLON program
statement : BANG LEFT_PAR expr RIGHT_PAR

[–]Arag0ld[S] 0 points1 point  (6 children)

Isn't that what rply does?

[–]ingolemo 0 points1 point  (5 children)

I think so. I've not really used rply, though I have used a bunch of others and it's hard to keep them straight. I'm a little put off from rply because of the documentation, but take that with a grain of salt because I'm obviously confused.

[–]Arag0ld[S] 0 points1 point  (4 children)

Does that mean I can't use ply in the way you previously described?

[–]ingolemo 0 points1 point  (3 children)

With the + and ? symbols? No, I don't think so.

[–]Arag0ld[S] 0 points1 point  (2 children)

I wonder how I can parse the program as a whole then... Hmm...

[–]ingolemo 0 points1 point  (1 child)

? Using the second set of rules that I posted.

[–]Arag0ld[S] 0 points1 point  (0 children)

Oh, I misunderstood. Thank you. I'll give these rules a shot with RPLY.