py, compiler: Add basic support for A=const(123).
You can now do:
X = const(123)
Y = const(456 + X)
and the compiler will replace X and Y with their values.
See discussion in issue #266 and issue #573.
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 9acfc14..2751478 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -109,6 +109,11 @@
/*****************************************************************************/
/* Fine control over Python features */
+// Whether to enable constant optimisation; id = const(value)
+#ifndef MICROPY_ENABLE_CONST
+#define MICROPY_ENABLE_CONST (1)
+#endif
+
// Whether to include the garbage collector
#ifndef MICROPY_ENABLE_GC
#define MICROPY_ENABLE_GC (0)