A stateful/functional/concurrent programming language? These are very rough notes as I'm getting too tired to write more about it tonight.
const int exampleconstant = 12345;
^ syntatic sugar for:
object exampleconstant {
start() = {int this = 12345; state = const;}
}
class foo {
start(type(input) != foo) = {
int i = 0;
int a = 32;
int b = 64;
state = wait;
}
start(typeof(input) == foo)) {
this = input;
}
iterate(typeof(input) == integer) = {
a = a + input;
b = b - input;
i = i + input;
output = a * b;
state = (a < b) ? iterate : end;
}
iterate(typeof(input) != integer) = {
print("illegal input: " + input);
output = error;
}
end() = {
output = i;
}
}
It's an odd mixture of functional/concurrent programming with a C-like syntax.
What makes it different than you see in the code sample...
- input and output are reserved variables. you don't have to 'catch' the output if it's not the type you're looking for, i think. they can also be arrays.
- state is an implicit variable that denotes what to run on the next trigger. i.e. all objects are state machines.
- functions are transactional. everything you see changed is actually pushed into the object at the end of the iteration - what would be a side effect in a regular language is *not* one here.
- objects can also be an instance of one variable.
----
slightly leaving cloudcucooland, i should write a simple FM-type synthesizer because, well, they're not hard to do.
the synth algo i have in mind supports continuous frequency adjustment (calculus-)integration. the frequency and amplitude are continuous functions in time, allowing for smooth changes in generated sound.
sine waves can be flattened from from triangular (0) to square (1), with sine = 0.5. phase restrictions can create interesting waveform patterns on top of that. for instance sawtooth waves can be generated by using (0, pi/4?) phase restrictions.
---
haven't touched my ARM project lately. need to get interrupts working, add newBSD/MIT license, and give credit to Vijay Kumar for showing the path.
I want something simple to play with registers without flashing - it might mean making the serial code I have now a bootloader that can cut over to a new downloaded program in memory... or I might write something small and FORTHlike.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment