# Sparkslabs Update #7 : New Pyxie Release 0.1.24 - Improved variable detection in else/elif, start of def statement implementation

# New Pyxie Release 0.1.24 - Improved variable detection in else/elif, start of def statement implementation

## Released: 10 November 2016

Hi,


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 neither `if` nor `elif` 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 function `populate_profile_context`.

* If you need to add extra types - ala the `Servo` type - you can use
  the `Servo` function call as an example. Note that it has a return
  type of `Servo`. This means of course that the `Servo` function is
  a constructor. For this to work   clearly the type needs to be
  defined - so you define it below in the variable `types`.

* Started on _parsing_ side aspects of definition of simple user functions.
  (ie `def` 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


## Feedback?

As usual, feedback is welcome.  What would you like to see?  Would you like
more detail, less detail?  Suggestions for project direction also very
welcome.


### Since last release

I had this feedback from the last release:

I have on my radar the idea of a web interface for pyxie. Interestingly one
user has some very good reasons for NOT wanting this, and so while I'll
probably be making a web interface, I'll make sure that it's an additional
method of doing things.


## Finally

As mentioned before, development of pyxie is strictly on my own time with
my own resources, and therefore development is not as fast as I'd like in
an ideal world.

If you'd like to help, please get in touch.

I've considered a kickstarter or IndieGoGo project to speed things up.
I'd also consider a patreon account. If there was one, do you think you
would contribute back that way, if you can't contribute code?

Whether or not you would consider it yourself, how much would you consider
reasonable to pledge? (This isn't a call to do so, but really an open
question - I do see a reasonable amount of traffic to my site from unique
users clearly looking for a python based mechanism for working with
arduinos natively)


## Availability

This release is available on github, pypi and my ubuntu ppa on launchpad.

* https://github.com/sparkslabs/pyxie
* https://pypi.python.org/pypi/pyxie/
* https://launchpad.net/~sparkslabs/+archive/ubuntu/packages

Dev plans:

* http://www.sparkslabs.com/pyxie/dev-status.html

As usual, and and all feedback welcome!


Michael. (@sparks_rd - https://twitter.com/sparks_rd)
