# HG changeset patch # User Nolan Prescott # Date 1628908495 14400 # Fri Aug 13 22:34:55 2021 -0400 # Node ID 1d25d33c5cc763ff9d6134479205c9f325cc535f # Parent 74dd4f4eb61debc45f4742e0cca03b8b0551d858 add README diff --git a/README b/README new file mode 100644 --- /dev/null +++ b/README @@ -0,0 +1,148 @@ + + + +strategic-communication +═══════════════════════ + + strategic-communication was designed and first implemented by the user + [rotoclone on github], where it was described as: + + A best-of-breed language with a holistic approach to + moving the needle. + + Also noted in the original is the following: + + The way I implemented the interpreter is super naive; it + re-parses every line it executes from its string + representation every time. There are likely other easy + performance gains I've ignored as well. + + In an effort to improve performance and expand target architectures + I've implemented a compiler from strategic-communication to C, + implemented here in Common Lisp. + + This README is modified from the original and all of the example + programs are borrowed from there to ensure program compatibility. + + +[rotoclone on github] +https://github.com/rotoclone/strategic-communication + +Register names +────────────── + + There are 8 available registers. Each one starts with a value of 0, + and can hold any 32-bit signed integer. They are named as follows: + • customer experience + • revenue streams + • core competencies + • best practices + • stakeholder engagement + • key performance indicators + • return on investment + • assets + + +Constants +───────── + + There are 10 constants used to represent literal numbers + + 1. HR + 2. Engineering + 3. Legal + 4. PR + 5. Finance + 6. Marketing + 7. R&D + 8. Sales + 9. Manufacturing + 10. Executive Management + + +Operations +────────── + + A Strategic Communication program consists of a series of operations + separated by newlines. + + Unless otherwise denoted, all operands must be register names. + + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Description Formats Notes + ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + increment the value in `x' `innovate x' `value-add x' + decrement the value in `x' `streamline x' `optimize x' + multiply the value in `x' by -1 `revamp x' `overhaul x' + multiply the value in `x' by 2 `amplify x' `incentivize x' + divide the value in `x' by 2 `backburner x' any remainder is discarded + set the value in `x' to a random number between 0 and 9 inclusive `paradigm shift x' + set the value in `x' to the value in `y' `align x with y' `y' can be a register name or a constant expression + set the value in `x' to the value of `y' `align y with x' `y' must be a constant expression + add the value in `x' to the value in `y' and store the result in `x' `synergize x and y' `integrate x and y' + subtract the value in `y' from the value in `x' and store the result in `x' `differentiate x and y' + read a single byte from stdin and store it in `x' `crowdsource x' if EOF is encountered, the value in `x' is set to -1 + print the value in `x' to stdout `deliver x' `produce x' UTF-8 encoding will be used + define a label called `x' `moving forward, x' `going forward, x' `x' can be any string containing no register names or constants + jump to label `x' `circle back to x' `revisit x' `x' must be a defined label + jump to label `x' if the value in `y' is zero `pivot y to x' `x' must be a defined label + jump to label `x' if the value in `y' is negative `restructure y to x' `x' must be a defined label + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + +Constant expressions +──────────────────── + + A constant expression is a sequence of one or more constants separated + by `,' or `and'. The value of the expression is the result of + concatenating the values of the constants. For example, `Engineering' + has a value of `1' and `Marketing' has a value of `5', so the + expression `Engineering and Marketing' has a value of `15'. + + More examples: + • `Engineering, Marketing, and HR' = `150' + • `Engineering' = `1' + • `HR and Engineering' = `1' (leading zeros are ignored) + • `Marketing, Marketing, Marketing' = `555' + + +Running a program +───────────────── + + Invoking the compiler is possible with the function `compile-to-c', it + takes a single argument of the strategic-communication program as a + string and will write the resulting C code out to a file + `t.c'. Subsequent runs will overwrite the file. + + If you happen to have `tcc' available you can run the generated + program directly with the function `run': + + ┌──── + │ CL-USER> (run "align Engineering and HR with stakeholder engagement + │ align revenue streams with stakeholder engagement + │ revamp revenue streams + │ align Finance and Manufacturing with customer experience + │ moving forward, think outside the box + │ deliver customer experience + │ deliver stakeholder engagement + │ innovate customer experience + │ innovate revenue streams + │ restructure revenue streams to think outside the box") + │ 0 + │ 1 + │ 2 + │ 3 + │ 4 + │ 5 + │ 6 + │ 7 + │ 8 + │ 9 + │ NIL + └──── + + Further examples can be found in the [original github repository]. + + +[original github repository] +https://github.com/rotoclone/strategic-communication/tree/7bf650ec85719b7026384762c5b65b8eaa13272d/examples diff --git a/README.org b/README.org new file mode 100644 --- /dev/null +++ b/README.org @@ -0,0 +1,125 @@ +#+OPTIONS: toc:nil num:nil author:nil + +* strategic-communication +strategic-communication was designed and first implemented by the user +[[https://github.com/rotoclone/strategic-communication][rotoclone on github]], where it was described as: + +#+BEGIN_QUOTE +A best-of-breed language with a holistic approach to moving the +needle. +#+END_QUOTE + +Also noted in the original is the following: + +#+BEGIN_QUOTE +The way I implemented the interpreter is super naive; it re-parses +every line it executes from its string representation every +time. There are likely other easy performance gains I've ignored as +well. +#+END_QUOTE + +In an effort to improve performance and expand target architectures +I've implemented a compiler from strategic-communication to C, +implemented here in Common Lisp. + +This README is modified from the original and all of the example +programs are borrowed from there to ensure program compatibility. + +** Register names + There are 8 available registers. Each one starts with a value of 0, + and can hold any 32-bit signed integer. They are named as follows: + - customer experience + - revenue streams + - core competencies + - best practices + - stakeholder engagement + - key performance indicators + - return on investment + - assets + +** Constants + There are 10 constants used to represent literal numbers + + 0. HR + 1. Engineering + 2. Legal + 3. PR + 4. Finance + 5. Marketing + 6. R&D + 7. Sales + 8. Manufacturing + 9. Executive Management + +** Operations + A Strategic Communication program consists of a series of operations + separated by newlines. + + Unless otherwise denoted, all operands must be register names. + + | Description | Formats | Notes | + |-----------------------------------------------------------------------------+-----------------------------------------+-----------------------------------------------------------------| + | increment the value in ~x~ | ~innovate x~ ~value-add x~ | | + | decrement the value in ~x~ | ~streamline x~ ~optimize x~ | | + | multiply the value in ~x~ by -1 | ~revamp x~ ~overhaul x~ | | + | multiply the value in ~x~ by 2 | ~amplify x~ ~incentivize x~ | | + | divide the value in ~x~ by 2 | ~backburner x~ | any remainder is discarded | + | set the value in ~x~ to a random number between 0 and 9 inclusive | ~paradigm shift x~ | | + | set the value in ~x~ to the value in ~y~ | ~align x with y~ | ~y~ can be a register name or a constant expression | + | set the value in ~x~ to the value of ~y~ | ~align y with x~ | ~y~ must be a constant expression | + | add the value in ~x~ to the value in ~y~ and store the result in ~x~ | ~synergize x and y~ ~integrate x and y~ | | + | subtract the value in ~y~ from the value in ~x~ and store the result in ~x~ | ~differentiate x and y~ | | + | read a single byte from stdin and store it in ~x~ | ~crowdsource x~ | if EOF is encountered, the value in ~x~ is set to -1 | + | print the value in ~x~ to stdout | ~deliver x~ ~produce x~ | UTF-8 encoding will be used | + | define a label called ~x~ | ~moving forward, x~ ~going forward, x~ | ~x~ can be any string containing no register names or constants | + | jump to label ~x~ | ~circle back to x~ ~revisit x~ | ~x~ must be a defined label | + | jump to label ~x~ if the value in ~y~ is zero | ~pivot y to x~ | ~x~ must be a defined label | + | jump to label ~x~ if the value in ~y~ is negative | ~restructure y to x~ | ~x~ must be a defined label | + +** Constant expressions + A constant expression is a sequence of one or more constants separated + by ~,~ or ~and~. The value of the expression is the result of + concatenating the values of the constants. For example, ~Engineering~ + has a value of ~1~ and ~Marketing~ has a value of ~5~, so the + expression ~Engineering and Marketing~ has a value of ~15~. + + More examples: + - ~Engineering, Marketing, and HR~ = ~150~ + - ~Engineering~ = ~1~ + - ~HR and Engineering~ = ~1~ (leading zeros are ignored) + - ~Marketing, Marketing, Marketing~ = ~555~ + +** Running a program + Invoking the compiler is possible with the function ~compile-to-c~, + it takes a single argument of the strategic-communication program + as a string and will write the resulting C code out to a file + ~t.c~. Subsequent runs will overwrite the file. + + If you happen to have ~tcc~ available you can run the generated + program directly with the function ~run~: + + #+BEGIN_SRC lisp + CL-USER> (run "align Engineering and HR with stakeholder engagement + align revenue streams with stakeholder engagement + revamp revenue streams + align Finance and Manufacturing with customer experience + moving forward, think outside the box + deliver customer experience + deliver stakeholder engagement + innovate customer experience + innovate revenue streams + restructure revenue streams to think outside the box") + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + NIL + #+END_SRC + + Further examples can be found in the [[https://github.com/rotoclone/strategic-communication/tree/7bf650ec85719b7026384762c5b65b8eaa13272d/examples][original github repository]].