#  Copyright(C) 1996, 1997 Network Flight Recorder, Inc.
#  All rights reserved.
#
#  Use and distribution of this software and its source code
#  are governed by the terms and conditions of the
#  Network Flight Recorder Software License ("LICENSE.TXT")

"input" is a simple stupid input file I was using to test
if/else processing.

This is the rough NFR interpreter. The grammar is fairly
simple - C-like if/else curlybraces and function calls. All function
calls are localized in bltin. Things compile down VERY small. Amuse yourself by
trying some expressions and debugging the sizes of the compiled machines.

Packet cracking is handled by the compiler's recognizing a
value in the form of STRING.STRING and generating a call
to a PACKET instruction. The main interpreter (is intended to)
trap that to a routine that decodes the value or pushes
an error on the stack. I think you can do an echo(system.time) and
it should work correctly...

Parse.y compiles a bytecode program and returns it. See main.c
for how it's called. The compiled bytecode program is passed
to run, which manages local symbols, (I forget if I rememberd
to build globals in or not) and so forth. Calls to builtins
are compiled by recognizing STRING(....) like C. See bltin
for details. Right now there are very few builtins, see bltin.c.
The way I call builtins is VERY fast -- you just pass the stack
address to the function, and it whaps the return value in
and away you go. I don't think I implemented my memory/garbage
collection system yet but that was easy; I can explain it
later. We don't need to worry about interpreted functions
calling other interpreted functions, which simplifies
things a lot, though my original interpreter could also
handle that (unrolling stack frames, etc, etc.) The design
for this was that if it was a function worth calling repeatedly
it should be a C-language builtin instead of an interpreted
function. So I envision functions like hostname(), alert(),
etc.

The interface to record data to plugouts is currently undesigned
so you won't see any of it in there.

Summary: this is a very clean compiler/interpreter for a very
simple language that looks familiar to all of us.

mjr.
