Commit Graph

9 Commits (master)

Author SHA1 Message Date
Mike Gerwitz 91919325a8
bin/pronounce: New script
I wrote this some time ago, but cleaned it up a bit so that others hopefully
can find this useful.  I'll be sure to use this as an example in my upcoming
LibrePlanet 2019 talk.

* bin/pronounce: New script.
2019-02-12 01:23:10 -05:00
Mike Gerwitz 14a0f86797
regex/README: New file
* regex/README: New file.
2018-11-28 21:10:46 -05:00
Mike Gerwitz 9478082e2e
env-{fixed,dyn}.sed: Accessing and manipulating envs
env-dyn kind of violated the spirit of this repository---to relax and simply
have fun.  While I did enjoy implementing it, there did become a point where
it got to be quite stressful and I just wanted to get it finished to move on
to other things.  Hopefully others find it interesting.

Keep in mind that, as explained in the comments, this could have been
implemented much more trivially using backreferences.  I chose not to do so,
since that is more of a challenge.  But it may be worth creating a version
of it that _does_ use backreferences to compare against and obviate the
limitiations of finite automata.

* regex/cmp.sed: Reference `env-dyn.sed'.
* regex/env-dyn.sed:
* regex/env-fixed.sed: New scripts.
2018-11-28 20:57:58 -05:00
Mike Gerwitz 3031364e14
regex: Add equality scripts
Continuing to build up a useful set of primitive examples.  This type of
thing is useful if we do not know all possible strings for comparison ahead
of time.

* regex/bitwise.sed: Add equality operator.  Modify existing OR and XOR
    regexes to accept this new operator.
* cmp.sed: New script.
2018-11-25 00:25:17 -05:00
Mike Gerwitz 3f5c397e83
animate: Add -c option for variable-width frames
Not all scripts produce fixed-width frames.  Variable-width frames leave
behind artifacts caused by characters from the previous frame not being
overwritten.

* regex/animate (usage): Document new `-c' flag.
  (main): Handle new `-c' flag.
    [refresh]: New variable.
* regex/base10-mul.sed: Remove extra whitespace used for frame clearing for
    animate script (just use `-c' now).
2018-11-24 23:57:48 -05:00
Mike Gerwitz 2dd5b590f9
bitwise.sed: Common bitwise operators using only regular expressions
This was less of a hack, but I wanted to formally document these operators
as a larger body of work to serve as an example to others.  In that sense,
I'm abusing the original intent of this repository, but it'll be fun to be
able to show others a more comprehensive body of regex-based hacks for doing
all sorts of fundamental things.

* regex/bitwise.sed: New script.
2018-11-24 00:02:31 -05:00
Mike Gerwitz 338bb0cdf0
base10-mul.sed: Multiply two base-10 numbers using regexes
This was a pretty fun hack---it looks esoteric and sounds impressive (or
even impossible to some), but is really easy given the proper
intuition.  Perhaps at some point I'll write more on DFAs and some of the
theory and limitations behind this, but for now, that's beyond the scope of
what I had intended for this repo.  (I suspect that my intentions are
shifting.)

Enjoy!

* regex/base10-inc.sed: Reference new script.
* regex/base10-mul.sed: New script.
2018-11-24 00:02:26 -05:00
Mike Gerwitz 107d090a04
base10-inc.sed: New script demonstrating regex-based addition
It might be easy to guess where I'm heading with the concepts that I'm
demonstrating with these scripts.  It's just fun to do, and I've never
had an excuse to actually do it.  ("It" referring to something for future
commits.)

You can try this out like this:

  $ ./animate base10-inc.sed <( echo 000 ) 0.01

* regex/base10-inc.sed: New file.
2018-11-24 00:02:20 -05:00
Mike Gerwitz cc583c6cb7
Initial commmit with fall script 2018-11-24 00:02:15 -05:00