
On Tue, Aug 18, 2020 at 07:39:29AM +0200, Marco Sulla wrote:
For example, many py programmers desider to make their objects a constant. This could be done in the example I wrote before:
from mykeywords import @const @const a = 1
The new `@const` will be added as a hook to the PEG parser. if the PEG parser finds a `@const`, it will invoke the miniparser of `mykeywords` module inherent to `@const`. In this case, it will simply transform `@const a = 1` in `const PyObject* a = PyLong_FromSsize_t((Py_ssize_t) 1)`
How does the parser know how to do that? You and I know that "const" means "constant", and you know how to implement that in the C code. What happens if I run that in Jython or IronPython? What if the keyword is `@qwerty`, how does the compiler know what to do? -- Steve