Ask coding questions

← Back to all posts
Sly parsing returning "None"
IMayBeMe (484)

I was working on a language using sly and encountered an issue with the if and else statements. I was just seeing if the parser correctly handles the input and wanted to print the first statement using print(p.statement0). When I run it, the output is None which is weird as there is an input. Since it's a team repl, the code it on like 65 - 68 and here is the link: https://replit.com/@DaKoolKidz/Scythe#src/main.py

Comments
hotnewtop
SreyasSabbani (62)

Like I said in the previous comment, I don't know much about sly but since Replit.com just had an update about Explore Tab and the .draw file, I would say it is a bug.

IMayBeMe (484)

@SreyasSabbani I'll mark eventually, but I just want to see if anyone knows if this is a sly specific issue.

SreyasSabbani (62)

@IMayBeMe, now will you mark as answer?

IMayBeMe (484)

@SreyasSabbani No cause you did not answer my question. Also I found a solution on the docs

SreyasSabbani (62)

@IMayBeMe, I guess it's okay. And also can you tell me the solution?

IMayBeMe (484)

@SreyasSabbani The solution was that my parsing design was all wrong and that I should have been constructing an AST that can be executed later.

SreyasSabbani (62)

I really don't understand anything you said @IMayBeMe, but I think this will be useful once I learn Sly and Python.

SreyasSabbani (62)

Interesting, I really don't know much about this. I would recommend to refresh the page, search it up on Stack-Overflow or on Google. I think it is just a bug, but it would be nice to search it up.

IMayBeMe (484)

@SreyasSabbani Yeah I have tried searching but haven't found much on sly at all let alone this issue.