by tylerFowler on 7/16/2019, 3:52:21 PM
+1 on learning by doing. And for me at least it's definitely a "use it or lose it" kind of thing. If I don't work with a given language for more than a month, when I get back to it I'll have to look up basic syntax for a few days until I pick it back up. Though I find this is less of an issue as you learn more and more languages.
by watergatorman on 7/16/2019, 6:53:30 PM
You don't, at least if the syntax/semantics is as complex as Python!
Recommendation:
Find a subset grammar for Python, by doing a search on computer science classes on university sites. You will find the published Python subset grammars probably too small for your purposes, but they are a start.
See if any of those subset grammars meet your needs.
IF not, remove from the published official Python grammar, various features that you do not need or are not easily understood. I recommend you keep the production rule for "class"
When you get a subset grammar that meets your needs, it will have to be well-formed, meaning it passes reachability, derivability, and non-circularity tests, has no undefined non-terminals, and is complete with a start (i.e., goal symbol.
You should then remove left-recursion and left-factor the grammar so it is LL(1).
Run your grammar through some of the on-line syntax checking sites to be sure the grammar is unambigous and is LL(1). You can use the online Grammophone tool from the University of Calgary to check your subset grammar.
After the grammar passes the LL(1) tests, find a top-down, predictive, compiler-generator that generates recursive-descent parsers, and not tables. The compiler-generator will also perform tests on your grammar and let you know what needs fixing.
I forgot to mention that you will also need to define the lexical tokens needed for the scanner portion before you can generate your scanner and parser modules.
After you generate the scanner, parser, and a main module to call them, you will have created a fast syntax checker for your subset grammar.
Run the fast syntax checker, preferably within a program editor or IDE, as you write your Python programs
You can also create "template editing macros" that will insert into your editor, portions of a Python program, but with portions elided, that you gradually fill-in. Also, you can add syntax-highlighting to your editor.
by simonblack on 7/16/2019, 9:44:48 PM
Usage. The more you use something consistently, the more you remember it.
However .... One thing I learned very early on is that in today's world, it's probably silly to try to clutter up your limited memory with stuff that you rarely use.
You can never remember everything. BUT ... you should know where to find it.
You have a computer with you, so use that as a source of reference.
Even today, after using C for decades, I will often do things like "man strtok" while programming.
by fetus8 on 7/16/2019, 3:39:57 PM
By writing code. The more I write, the more I get familiar with the syntax and semantics of the language.
by ashwanidausodia on 7/16/2019, 3:39:56 PM
Practice. A lot of practice
I am learning Python, and having hard a time with concentrating and retaining syntax, and semantics.
What to do to memorize and retain the grammar of Python?