tobias-kohn / tigerpython-parser Goto Github PK
View Code? Open in Web Editor NEWEnhanced error recognition in Python
License: Mozilla Public License 2.0
Enhanced error recognition in Python
License: Mozilla Public License 2.0
Running
TPyParser.findAllErrors("{1:1=")
uses 100% of a core and then crashes the Chrome tab.
This was stripped down from something slightly more meaningful, but still invalid Python!
Running the same in NodeJS it's a bit clearer that it fails by running out of memory.
I have integrated TigerPython-Parser into a Python learning game.
I would like to be able to modify some error messages in French. But the setErrorMessage method does not work for the French language. As shown in the code below quoted from ErrorTranslator.scala
override def setMessage(code: ErrorCode.Value, msg: String): Boolean =
_lang match {
case "de" =>
errormessages.GermanMessages.setMessage(code, msg)
true
case "en" =>
errormessages.EnglishMessages.setMessage(code, msg)
true
case _ =>
false
}
}
Then how can I change these messages?
Thank you in advance,
Matthieu BRANTHÔME
Hi Tobias,
When testing my application in the classroom, one student encountered this problem:
I unfortunately don't have the Python code that caused the error, but if the error comes back, I will try to collect the Python code that causes this problem.
Any idea of what the problem is? Maybe a recurring call with no break cases?
Thks,
Matthieu
One common mistake for the novices, at least in french speaking part of switzerland, is to use the comma instead of the .
for floating point literals. This is because we say "nombre à virgule" to denote numbers with decimal positions. This generates errors really difficult to decrypt for the novices
from gturtle import *
makeTurtle()
size = 10
for _ in range(10):
fd(size)
rt(360 / 6)
size *= 1,2
Context: TigerPython is used in a Vue project. I am calling the parser to get the python AST of some small code portions.
When the parser finds a comparison, the returned expression object contains a left
property that I can access. However, the comparators
and ops
properties cannot be accessed, because I get the following error : "Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.r"
The Python grammar allows underscores in the number litterals to increase readability. For instance, Python accepts litterals like 1_000_000
for 1 million. It would be great if the parser would accept that syntax.
I don't know what they currently do for syntax checking but I suspect they didn't hire a Ph.D. to do it. :-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.