caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [ANN]BrainScan - A source-code model checker for BrainF*ck
@ 2006-09-23 18:05 Yoriyuki Yamagata
  2006-09-23 18:06 ` Yoriyuki Yamagata
  0 siblings, 1 reply; 2+ messages in thread
From: Yoriyuki Yamagata @ 2006-09-23 18:05 UTC (permalink / raw)
  To: Caml List

BrainScan is a simple source-code model checker for BrainF*ck.  It
uses depth-first search with states in the buffer cells represented as
sets of integer intervals.

To compile, you need OCaml, findlib, and extlib.
$ make
This create a binary called brainscan.  Then you can give BrainF*ck
program as the argument.

$ ./brainscan '+[]!'
$

BrainScan checks the following condition and prints the command trace
if such conditions could arise.

1. Underflow of the pointer
2. Overflow (> 255) and Underflow (<0) of a buffer-cell value.  (Only
with -R or --range option.)
3. Reach the positions marked by !

In the case above, the program infinitely loops between [ and ].
Hence it never reaches !.  BrainScan understands this, and terminates
without error messages.  On the other hand,

$ ./brainscan ',[]!'
! reached.
        0: ,
        1: [
        3: !

this program may reach ! depending on the input at the ",".

Enjoy!
-- 
Yamagata Yoriyuki


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-23 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-23 18:05 [ANN]BrainScan - A source-code model checker for BrainF*ck Yoriyuki Yamagata
2006-09-23 18:06 ` Yoriyuki Yamagata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).