Release 0.1.24 - Improved variable detection in else/elif, start of def statement implementation
Overview
Main focus of this release is fixing detection of variables inside
else/elif statements and internal changes.
These fixes actually enable some fun things - like the ability to control
complex robots - like robot puppies/kittens with multi-motor limbs and
sensors, so an example of doing that has been added. It's probably
the first major non-trivial example.
Additionally the ability to extend the arduino profile has been made
easier through bundling together everything to do with the arduino
profile into pyxie/profile/arduino.py
. This also acts a template for
creation of other profiles. (For example, I'll add a micro:bit profile
at some point) See the changelog for more details.
There's been a number of other changes. Some internal which aren't really
user facing, but affect development - such as major reprioritisation
of the backlog (see www.sparkslabs.com/pyxie/dev-status.html). The
pyxie-dev tool I use for managing releases has been overhauled. There's
been significant improvements to the way pynodes are handled as well.
Lastly, I don't normally talk about upcoming changes, but I've started
the beginnings of implementation of user functions - ie def statements.
The python parsing side and analysis side has been completed for
functions with no arguments, no return values, and so on. However,
the conversion of this to the C++ side of things really requires
major changes to the internals of how the C++ is generated.
This will take time, so this release just contains the parsing,
and analysis side of things. The next release should contain code
generation and compilation.
Changelog
What's been fixed?
- Code generation for
else
/elif
was failing when the statements inside
contained identifiers. This was due to context not propogating into
else
/elif
. This was caused by neitherif
norelif
adding else clauses
as children. This was done and now this operates correctly.
What's New?
- Added playful puppy example that compiles and controls the Dagu Playful Puppy
robot. (8 leg servos, 2 head/neck servos, infrared array sensor/eye)- v0 no funcs Playful Puppy code analyses #213
- v0 no funcs Playful Puppy code generates code #214
- v0 no funcs Playful Puppy code compiles, & runs on device correctly #215
- Profile specific code has been extracted to a specific file. In this
case, the iniitial profile made more managable is of course the arduino
profile. To configure this/extend this, you now update the file
pyxie/profile/arduino.py
- To add more predefined variables/etc that are used in the context (ala
A0, etc) you extend the functionpopulate_profile_context
. - If you need to add extra types - ala the
Servo
type - you can use
theServo
function call as an example. Note that it has a return
type ofServo
. This means of course that theServo
function is
a constructor. For this to work clearly the type needs to be
defined - so you define it below in the variabletypes
. - Started on parsing side aspects of definition of simple user functions.
(iedef
statements) Hopefully basic functions should be in the next
iteration of pyxie.
Internal Changes
pyxie-dev
- Pyxie's release management tool, has had an overhaul,
and transferred into the pyxie package, rather than standalone code.
In the process code was improved, such that "dryrun" and "verbose"
now mean precisely that. Help text is deliberately verbose to note
what the release process is.- Check all Pynodes add all sub nodes as children correctly #264
- Start of function support:
- Lexing for function definition succeeds #265
- Grammar parsing for function definition succeeds #266
- Pynode support for def statements #269.
- Add a callable type #270
Other
- Reorganised backlog based on priorities - need, useful, want, wouldlike.
Plan going forward is to primarily focus on needs, and one or two from
each of the other categories. - Function call code supports simplified type definitions for externals. #34
- Block structure of generated C Code is pretty/human friendly/readable #26
- Add special case for function calls like print #37