[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
An interesting demo
From: |
Doug McIlroy |
Subject: |
An interesting demo |
Date: |
Thu, 27 Aug 2020 20:22:20 -0400 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
For a demonstration of the power of m4 stripped to the
bare minimum--no builtins other than `define'--see
www.cs.dartmouth.edu/~doug/barem4.txt. (Because browsers
may not like .m4 files, it's called .txt--but is not
Windows format.) Well-commented code builds quickly from
nothing to binary arithmetic. Final remarks outline how
to simulate a computer and its memory--all within m4.
To try it, you might begin by entering one of the many
examples given in the program's comments:
prompt> m4 barem4.txt -
base2(mpy(add(one,two)),two))
110
add(one,two)
(1,(1,()))
I hope you enjoy it. Comments and criticism will be
gratefully received.
Doug
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- An interesting demo,
Doug McIlroy <=