Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax checker
#1
I need to make a syntax checker. The way it should work:
The input is a text file which contains lines of codes (eg.:for i in range(5):print(i)). The program checks them, then decides whether it's syntactically correct or not. I require some help with this task. It's all new for me.
Reply
#2
Start coding the task using the skills you have learned so far, when you get stuck on a particular part, post code in code tags and explain what you think should be happening and what is actually happening, also post any errors in error tags.
Reply
#3
I simply don't know how to make it. I have the basics but this is a task I need to do as soon as possible, even though nothing like this was explained to us in class.
Reply
#4
You can use the py_compile module. python -m py_compile myfile.py

https://docs.python.org/3/library/py_compile.html
Reply
#5
I solved it with the ast module but Thank you I will check it out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Password Checker Assignment mcostello 1 5,054 Nov-14-2020, 07:54 AM
Last Post: DPaul
  Palindrome checker case sensive edwdas 3 2,628 Nov-07-2019, 05:57 PM
Last Post: nilamo
  "Travis" guest list name checker (Ziyad Yehia Udemy course) Drone4four 8 3,953 Aug-24-2019, 03:46 PM
Last Post: jefsummers
  Spell Checker Liquid_Ocelot 1 3,179 May-07-2017, 11:28 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020