Add a B man page.
authorDavid Given <dg@cowlark.com>
Sat, 7 Jan 2017 21:35:02 +0000 (22:35 +0100)
committerDavid Given <dg@cowlark.com>
Sat, 7 Jan 2017 21:35:02 +0000 (22:35 +0100)
lang/b/compiler/build.lua
lang/b/compiler/em_b.6 [new file with mode: 0644]

index 2756428..6e2cc18 100644 (file)
@@ -21,7 +21,8 @@ cprogram {
 installable {
        name = "pkg",
        map = {
-               ["$(PLATDEP)/em_b"] = "+em_b"
+               ["$(PLATDEP)/em_b"] = "+em_b",
+               ["$(INSDIR)/share/man/man6/em_m2.6"] = "./em_b.6"
        }
 }
 
diff --git a/lang/b/compiler/em_b.6 b/lang/b/compiler/em_b.6
new file mode 100644 (file)
index 0000000..e0d1b40
--- /dev/null
@@ -0,0 +1,68 @@
+.TH EM_B 6
+.ad
+
+
+.SH NAME
+em_b \- ACK B compiler
+
+
+.SH SYNOPSIS
+.B ~em/lib/ack/em_b
+.RI [ options ] 
+
+
+.SH DESCRIPTION
+.I em_b
+is a port of the ABC B compiler to the ACK. Interested parties will be
+interested in the upstream distribution here:
+
+.nf
+.sp
+https://github.com/aap/abc
+.fi
+
+However, the version here has been heavily modified --- bug reports should be
+filed with the ACK, not with the upstream compiler.
+
+.PP
+Since B was designed for machines with word addressing, some hacking is
+required to make it work on modern, byte addressed machines. The generated
+code expects B variables to contain word addresses, and then generates
+code to transform these into native addresses before use (which,
+unfortunately, impacts performance). However, the ACK's linker doesn't know
+how to emit word addresses into the program's data sections, and so a
+separate fixup stage has to happen at runtime, just before \fBmain()\fP,
+to convert the byte addresses into word addresses.
+
+.PP
+The end result is that using multiple source files with B is somewhat
+unwieldy, requiring each module to be explicitly named and then an extra
+stage to generate the fixup code. See the \fBack\fP(1) and \fBabmodules\fP(1)
+for details.
+
+
+.SH OPTIONS
+
+.I em_b
+accepts the following flags:
+
+.IP \-w\ \fIsize\fP
+Sets the word size, used for scaling addresses. Usually either 2 or 4.
+
+.IP \-B\ \fIname\fP
+Sets the name of the module currently being compiled (used to generate the
+fixup table symbol name). Defaults to \fImain\fP if not specified.
+
+.IP \-i\ \fIfilename\fP
+The source B file.
+
+.IP \-o\ \fIfilename\fP
+The output compact EM bytecode file.
+
+
+
+.SH SEE ALSO
+\fIack\fR(1), \fIabmodules\fR(1)
+
+.SH REMARKS
+It is very unlikely the \fIem_b\fP will ever be useful for anything.