Usage

(require-extension flsim)

Documentation

The flsim library provides definitions for a simple applicative language capable of expressing finite state machines, code generators for Scheme and Standard ML, as well as a library implementing explicit Runge-Kutta solvers for ordinary differential equations.

Data types

(define-datatype value value? ...)

Representation of values in the language. The value definitions are:

(V:C const)

Constant values. Currently supported are numeric and symbolic constants.

(V:Var name)

Variable name. NAME must be a symbol.

(V:Rec fields)

Record constructor. FIELDS is a list of elements of the form (NAME VALUE).

(V:Sel field value)

Record field selector. FIELD is a field name (symbol), and VALUE must be a record value.

(V:Vec (value ...))

Vector constructor.

(V:Sub index value)

Vector element selector. INDEX must be a positive integer, VALUE must be a vector value.

(V:Ldv value)

Load a value from a pointer value.

(V:Stv value)

Creates a pointer value pointing to the given value.

(V:Fn args body)

Parametric expression. ARGS must be a list of symbols, BODY must be an expression (see below for definition).

(V:Prim name args)

Primitive procedure application. NAME must be a symbol, ARGS must be a list of values.

(V:Ifv test iftrue iffalse)

Conditional value.

(define-datatype expr expr? ...)

Representation of expressions in the language. The expression definitions are:

(E:Val name value)

Creates a binding that associates the given name with the given value

(E:Ife test iftrue iffalse)

Conditional expression.

(E:Let bindings body)

An expression with bindings.

(E:Set loc value)

Points the given pointer to the given value.

(E:Ret value)

Returns the given value.

(E:Seq expressions)

A sequence of expressions.

(E:Noop)

Null expression.

Language constants

The language defined in this library assumes the presence in the host language of the standard ANSI C floating-point arithmetic and mathematical functions.

Procedures

Scheme code generator

[procedure]name/scheme :: NAME -> NAME

Converts a given name (symbol) to a valid Scheme identifier.

[procedure]prelude/scheme :: VOID -> FRAGMENTS

Returns a set of definitions needed by the Scheme code generator. FRAGMENTS is a list of strings, symbols, or fragments.

[procedure]expr->scheme :: EXPRESSION -> FRAGMENTS

Generates a representation of the given expression in Scheme.

[procedure]value->scheme :: VALUE -> FRAGMENTS

Generates a representation of the given value in Scheme.

ML code generator

[procedure]name/ML :: NAME -> NAME

Converts a given name (symbol) to a valid Standard ML identifier.

[procedure]prelude/ML :: VOID -> FRAGMENTS

Returns a set of definitions needed by the Standard ML code generator. FRAGMENTS is a list of strings, symbols, or fragments.

About this egg

Author

Version history

Initial code generator for Octave; some streamlining of the integrator interface

1.0

Initial release

License

Copyright 2010-2011 Ivan Raikov.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
A full copy of the GPL license can be found at
<http://www.gnu.org/licenses/>.