Skip to content

Instantly share code, notes, and snippets.

Created September 21, 2015 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/06dfef13d917ddd6bcae to your computer and use it in GitHub Desktop.
Save anonymous/06dfef13d917ddd6bcae to your computer and use it in GitHub Desktop.
SIMPL - Minimal Interpreted Programming language
// SIMPL
// A Serial Interpreted Minimal Programming Language
// Inspired by Txtzyme - by Ward Cunningham
// Filename simpl_2015_slim_6
// This is the slim verasion of simpl that removes most of the Arduino specific routines - saving almost 1800 bytes
// Some fixed "Musical Tones"
// 40{1o1106u0o1106u} // A 440 Hz
// 45{1o986u0o986u} // B 493.88 Hz
// 51{1o929u0o929u} // C 523.25 Hz
// 57{1o825u0o825u} // D 587.33 Hz
// 64{1o733u0o733u} // E 659.26 Hz
// 72{1o690u0o691u} // F 698.46 Hz
// 81{1o613u0o613u} // G 783.99 HZ
// SIMPL compiles in under 4.8K - leaving lots of room for other stuff
// The core kernel is only 2k bytes
// SIMPL allows new words to be defined by preceding them with colon : (Like Forth)
// New words use CAPITALS - so 26 words are possible in the user's vocabulary
// Words A-F have been predefined as musical tones - but you can write over them
// A word can be a maximum of 48 characters long
// Type ? to get a list off all defined words
#define F_CPU 16000000UL // define the clock frequency as 16MHz
#define BAUD 115200
#include <util/setbaud.h> // Set up the Uart baud rate generator
#define bufRead(addr) (*(unsigned char *)(addr))
#define bufWrite(addr, b) (*(unsigned char *)(addr) = (b))
// This character array is used to hold the User's words
char array[26][48] = { // Define a 26 x 48 array for the colon definitions
{"6d40{1o1106u0o1106u}"},
{"6d45{1o986u0o986u}"},
{"6d51{1o929u0o929u}"},
{"6d57{1o825u0o825u}"},
{"6d64{1o733u0o733u}"},
{"6d72{1o690u0o691u}"},
{"6d81{1o613u0o613u}"},
{"_Hello World, and welcome to SIMPL_"},
{"5{ABC}"},
{""},
{""},
{""},
{"_This is a test message - about 48 characters_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment