Skip to content

Release 0.1.23 - major arduino profile improvements, print-as-function not statement

Compare
Choose a tag to compare
@sparkslabs sparkslabs released this 02 Nov 10:51
· 84 commits to master since this release

This release is a fairly major release - which has prompted a bump of release number to 0.1.23, rather than 0.0.23. (I'm keeping the patch level the same so there's a general release count.)

Major Changes

  • The arduino profile is now sufficient for building little robots that are
    made of microcontrollers, servos, sensors and can report data via the serial
    port.
  • Ability to use function calls in assignment statements - such as calls in
    to arduino libraries.
  • The arduino profile is now documented - both in docs/ and also on the website.
  • More examples:
    • Analog example - showing use of reading/writing analog values, and use
      of serial port, map, constrain, random, millis etc
    • puppy - this is for controls the Dagu playful puppy (a small quadruped
      robot with 10 servos and IR sensor "eye")
  • print is now a function, not a statement. This was always coming, but
    this has been forced by practicalities. Things like Serial.print - necessary
    for arduino support - are not valid python if you have print as a statement.
    It's useful also that this also brings us closer to python 3's syntax.

Arduino Support

Specific set of functionality checked/added in this release:

  • Serial support - .begin(), .print(), .println()
  • constrain
  • map
  • random, randomSeed
  • analogWrite
  • analogRead
  • millis
  • Support for constants/ids : A0-A7, HIGH, LOW, INPUT, OUTPUT

This is in addition to other previous functionality like: Servos, Digital IO, time delays, etc

Changelog

What's New?

  • Lots of internal changes to switch print from being a statement
    to a function call
    • Update all tests to use print as function, not as statement
    • Lexer - remove keyword
    • Disable "print" as statement type in the grammar
    • Disable "print" as a pynode in the AST model
    • Transform bare function calls to "print" (not method accesses)
      into print statements internally. This will need improving
      later, but for now is enough. It will need improving once we
      implement custom function support.
  • Enable use of function calls as rvalues in assignments such as "analogRead"
  • Added README.md for the analog example
  • Update examples/README.md overview of the various examples.
  • Initial user (single page) documentation of how to use the arduino profile

What's been fixed?

  • Handle emitting identifiers as rvalues in assignments correctly

Internal changes

  • Add recursive lookup through context stacks. This allows us effectively to
    manage scope, to be able to treate profiles as an enclosing scope, and a step
    towards being able to generate better error messages.
  • Initial tests with profile nodes (for context). Tag is profile_identifier.
    Purpose is primarily to support analysis.
  • Simplify cruftiness/verbosity of logging from parser
  • Clarify source of logging messages
  • Update site/src/panels/current-grammar.md to match current grammar...
    • remove print_statement
    • minor cleanups
    • Expression syntax supports expression molecules - object method access

Other

  • Document how the various autogenerated docs get generated.
  • Some extra scripts in test-data - designed to support quick turn around
    testing of specific language features.
  • Created a default (empty) global context stack - may provide a better hook
    for things like print-as-function later on.
  • Help with debugging
    • Add tags to contexts
    • Tag global context as program context
    • Tag (test) arduino profile context as "arduino"
  • Support for analogRead, analogWrite, (arduino) map, and Serial object
    • Example added exercising these
  • Updated docs