Getting ready for spring break
So this week I got some more work done on the compiler. I got correct wrapping for PROGMEM variables.
I also can a series of cases to figure out what I still needed to fix/implement.
First, here is an example of the first two projects form SparkFun's Inventor's Guide:
#/
blink.minno
by Logan Davis
A simple blink program.
3/7/17 | Minno V"too early to tell" | devOS: macOS
/#
let outputPin : int = 13; //set pin for reference
def setup none -> none {
//set mode to output
pinMode outputPin OUTPUT;
}
def loop none -> none {
// blink on and off with 1 sec intervals
digitalWrite outputPin HIGH;
delay 1000;
digitalWrite outputPin LOW;
delay 1000;
digitalWrite outputPin LOW;
}
What it outputs:
const PROGMEM int outputPin = 13 ;
void setup () {
pinMode(pgm_read_word(&outputPin),OUTPUT) ;
}
void loop () {
digitalWrite(pgm_read_word(&outputPin),HIGH) ;
delay(1000 ) ;
digitalWrite(pgm_read_word(&outputPin),LOW) ;
delay(1000 ) ;
digitalWrite(pgm_read_word(&outputPin),LOW) ;
}
And the second:
#/
potReader.minno
by Logan Davis
A simple blink that reads delay time from
a 1k pot.
3/7/17 | Minno V"too early to tell" | devOS: macOS
/#
let sensorPin: int = 0;
let ledPin: int = 13;
def setup none -> none {
pinMode ledPin OUTPUT;
}
def loop none -> none {
let sensorVal : mutable int = analogRead sensorPin;
digitalWrite ledPin HIGH;
delay sensorVal;
digitalWrite ledPin LOW;
delay sensorVal;
}
Output:
const PROGMEM int sensorPin = 0 ;
const PROGMEM int ledPin = 13 ;
void setup () {
pinMode(pgm_read_word(&ledPin),OUTPUT) ;
}
void loop () {
int sensorVal = analogRead(pgm_read_word(&sensorPin)) ;
digitalWrite(pgm_read_word(&ledPin),HIGH) ;
delay(sensorVal) ;
digitalWrite(pgm_read_word(&ledPin),LOW) ;
delay(sensorVal) ;
}
The things to code over break are the following:
- Add for-loop and return syntax. These will be easy given that that are just atomic symbols that can be parsed with generic statements following them (which I already have a parser and translator for)
- correct behavior that wraps variables defined in functions as immutable in prg_read function. Should just be adding some logic and flags. I already do something similar for making sure not to wrap Arduino CONSTANTS in prg_read.
- Implement a basic semantic verifier (arity and such). I already have a tables that have 50% of this info for other tasks, so it is fairly straightforward.
- fix bug that is causing redefine's of mutable statements to fail parsing.
- Write up docs and finish implementing some Sparkfun conversions.
- allow for nested arrays.
As for the paper, I just need to finish a little section of Making Minno. After that It should just be revising and proof reading. I hope to get through 2 drafts of both papers each by the end of spring break.