Download the source with git,
git clone https://github.com/python/cpython.git
or you can download a zip file.
PCbuild\build.bat -e -d
Generate the Makefile with
Then we can build Python.
If we’re compiling on macOS or Linux, we can speed things up with ccache. Compiling with ccache lets us only compile files that have changed so that we don’t have to recompile the entire project because one file changed.
sudo apt-get install ccache
pacman -S ccache
brew install ccache
To use ccache when we compile Python, we just have to make two changes to the Makefile. We need to replace the following lines
CC= gcc -pthread CXX= g++ -pthread
with the following.
CC= ccache gcc -pthread CXX= ccache g++ -pthread
Now everytime running
make after the first, the compilation will be much quicker.
In Python, we have to
import modules before we can use them,
but we’ve decided we don’t like the word
import and want to
giveme modules instead.
Looking at the grammar section on Python’s dev-guide gives us some clues on how to start.
The first thing on that checklist says to look in the file “Grammar/Grammar”. When we look through it, we search for the word
we find this:
So let’s add a rule to use
Now, after we
make we can use our new syntax.