1 Brief Overview
2 Principles of Operation
The Yhc compiler generally produces a binary bytecode file (usually named with .hbc extension) for each Haskell module compiled. These bytecode files are to be interpreted by yhi, a command-line bytecode interpreter.
The compiler is also capable of producing a binary core file (usually named with .ycr extension), and also its human-readable representation for each Haskell module compiled. The internal structure of core is based on significantly simplified nhc98's PosLambda constructs (Yhc is derived from nhc98 code). Core consists of definitions for compiled Haskell functions and data objects.
The feature of core linking was added recently to Yhc. This allows for merging core files from several modules together, removing functions that are not used (similar to static linking performed by a traditional Unix or Windows executable linker). The resulting file (usually named with .yca extension) has the same format as per-module core files.
Binary core files may be read back into computer memory using the Yhc Core API functions.
3 Users Guide
<to be written>
4 Inner Workings
|HSCons||C||*||Builds a list CONS cell||head:
remainder of the list
|HSEOL||C||*||Final element of a list or an empty list|
|HSFun||C||*||Creates a function thunk with no arguments applied to||name:
function name to be used for debugging/exception tracing
arity of the function known by the compiler
expression to apply to function's arguments and evaluate
|HSDly||C||*||A special object to wrap around a saturated function call||thunk:|
saturated function call that is a HSFun object with number of arguments applied to (_a) equal to the function arity (_x); evaluation of this thunk will be delayed until it is applied to an argument which would have oversaturated the call in the absence of HSDly
|HSData||C||*||Builds a data object other than a CONS cell or an Empty List||con:
constructor name (with non-alphanumeric characters replaced with underscored character codes)
|_r||P||*||*||*||*||*||Boolean: true when a thunk may be evaluated.
|_c||M||*||*||*||*||*||Evaluate a thunk. If this method is said as "has no action", this means that it just returns |
|_ap||M||*||*||Apply function call/delayed saturated call to argument(s)
Array containing the arguments to be applied to
|_b||P||*||Holds the expression to apply to function's arguments and evaluate: the third argument of the HSFun constructor is copied here|
|_x||P||*||Holds the function arity: the second argument of the HSFun constructor is copied here|
|_n||P||*||Holds the function name: the first argument of the HSFun constructor is copied here|
5 Examples and Demos
Description: Type any text in the input field provided, and see it echoed right above.
Tested with: Netscape 7/Linux
Demo URL: http://darcs.haskell.org/yhc/web/jsdemos/Echo.html
Haskell Source: http://darcs.haskell.org/yhc/web/jsdemos/Echo.hs
--DimitryGolubovsky 19:02, 6 November 2006 (UTC)