Jump to content

ASCII art diagram converter: Difference between revisions

→‎{{header|Racket}}: noise regarding 24/32/64 bit words
({{header|Racket}} implementation added)
(→‎{{header|Racket}}: noise regarding 24/32/64 bit words)
Line 346:
=={{header|Racket}}==
 
ThereeThree files:
* <b><code>ascii-art-parser.rkt</code>:</b> provides the function <code>ascii-art->struct</code>, which converts ASCII art from a string (or input port) to a list of word-number, bit range and id
* <b><code>ascii-art-reader.rkt</code>:</b> uses this to provide a sytntax <code>define-ascii-art-structure</code> which defines a structure using the art work
* <b><code>test-ascci-art-reader.rkt</code>:</b> gives it all a rigourousish going over
 
Note that if you want to extend the word width too 32-bits (or more) add multiples of eight bit blocks horizontally (i.e. <code>--+--+--+--+--+--+--+--+</code>). IMO Having the diagrams 16-bits wide reflects the choice of a 16-bit word as the natural word size of the interface. If it were 32 or 64, the blocks would have to be wider.
 
<b><code>ascii-art-parser.rkt</code></b>
569

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.