SUPERCEDED BY ZapoTeX
Download:
(note: up-to-date version in next post) Language: Objective Caml License: GNU GPL OS: Any
Description:
DumBeX is a filter, taking lines of B notation on STDIN, and churning out corresponding LaTeX code on STDOUT. This is useful if you are using the B method and need to embed some code in a report: translate just what you need on demand or whole source files automatically.
Examples: Usage:
It is a filter. So
Code: Select all
dumbex < file.B > file.B.tex
Code: Select all
\definecolor{Bcomment}{rgb}{0.2,0.2,0.6}
\definecolor{Bkeyword}{rgb}{0.3,0,0}
\definecolor{Bverbatim}{rgb}{0.9,0.3,0.3}
\def\loadB#1{{\sffamily \noindent\input{#1.tex}}}
Code: Select all
\loadB{file.B}
If you have several files, feel free to use some shell script to make it easier:
Code: Select all
for i in *.b; do
dumbex < $i > $i".tex" 2> /dev/null
done
Code: Select all
dumbex cc blue
Notes and restrictions: (in no particular order)
- I called it "dumb" because it is a simple regexp script, the initial version of which was hacked in rougly an hour, because I wanted a program to do the job now and didn't have time or motivation to do anything more subtle. There may be other such translators out there, but I couldn't find one on the net when I needed it. 'B' is such a dreadful keyword for internet search...
- I used my first afternoon of vacations to extend it to support most B operators.
- It is not a parser for B notation. Consequently, while it does the job in most cases, there are things it will never do: for instance, it will never be able to tell the difference between IF-the-keyword and IF-the-set-you-just-defined.
- It outputs the LaTeX code for each symbol directly. A more elegant solution would be to output commands defined in an external package, so as to allow the user to redefine some of them in her document. Until then, if you want different symbols, you'll have to change the source code.
- If you need any help with it, you are welcome to post here (avoid sending me a mail though).
