Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master

Updated build scripts and documentation

to better reflect the support for building both Youtoo and EuXLisp
latest commit 5f6d8c385f
@Henry authored

README.org

Youtoo

Copyright

Youtoo 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 2 of the License, or (at your option) any later version.

Youtoo 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.

You should have received a copy of the GNU General Public License along with Youtoo in the file COPYING. If not, see http://www.gnu.org/licenses/.

General

See EuLisp.

Features

~/.eulrc.${ARCH}

For private customisation, put a copy of .eulrc.${ARCH} in your home directory. For example, remove the optimisation flag of the C compiler.

EuLisp Module Files

Have the extension .em.

EuLisp Language Level-1

Level-1 is provided by the library liblevel-1.a. Standard syntax operators are defined in the module syntax-1. Thus, the default module body looks like this:

(defmodule foo
  (syntax (syntax-1)
   import (level-1))

  ...

  )  ;; end of module

Pretty Printing

The function pprint provides generic pretty printing.

Main

There is no main entry function Top-level forms in modules are executed with with respect to the module hierarchy. Global variables *argc* and *argv* are provided.

Standard Bindings

See Doc/bindings.txt for a list of standard bindings.

Module Compilation

The compiler checks before compiling a module which (directly and indirectly) imported modules really need to be (re)compiled. This feature can be switched off with -no_recompile.

Standard C foreign-functions

in Youtoo/include/eulisp.h

Data conversion from EuLisp to C:
int     eul_fpi_as_c_int(LispRef x);
int     eul_bool_as_c_bool(LispRef x);
double  eul_double_as_c_double(LispRef x);
LispRef eul_fpi_as_dbl(LispRef x);
char    eul_char_as_c_char(LispRef x);
char    *eul_string_as_c_string(LispRef x);
char    *eul_symbol_as_c_string(LispRef x);
Data conversion from C to EuLisp:
LispRef c_int_as_eul_fpi(int x);
LispRef c_bool_as_eul_bool(bool x)
LispRef c_char_as_eul_char(char x);
Creating symbols and keywords:
eul_intern_symbol(LispRef loc, char *str);
eul_intern_keyword(LispRef loc, char *str);
EuLisp data allocation:
eul_allocate_int(LispRef loc, int x);
eul_allocate_double(LispRef loc, double x);
eul_allocate_char(LispRef loc, char x);
eul_allocate_string(LispRef loc, char *str);
eul_allocate_cons(LispRef loc, LispRef x, LispRef y);
eul_allocate_vector(LispRef loc,int n, LispRef init);
eul_allocate_object(LispRef loc, LispRef class, LispRef n, LispRef init);
EuLisp constants:
LispRef eul_nil;
LispRef eul_t;
EuLisp data access:
LispRef eul_car(LispRef x);
LispRef eul_cdr(LispRef x);
LispRef eul_slot_ref(LispRef x, int i);
LispRef eul_symbol_name(LispRef x);
LispRef eul_keyword_name(LispRef x);
LispRef eul_class_of(LispRef x);
LispRef eul_size_of(LispRef x);
LispRef eul_string_size(LispRef x);
EuLisp data predicates:
int eul_null(LispRef x);
int eul_is_symbol(LispRef x);
int eul_is_keyword(LispRef x);
int eul_is_int(LispRef x);
int eul_is_double(LispRef x);
int eul_is_char(LispRef x);
int eul_is_string(LispRef x);
int eul_is_cons(LispRef x);
int eul_is_list(LispRef x);
int eul_is_gf(LispRef x);
int eul_is_lambda(LispRef x);
int eul_is_operator(LispRef x);

Using the foreign-function interface

Uses automatic converters. Here is an example how atoi can be used from Lisp:

(defextern atoi (<string>) <fpi>)

If the desired external function foo is in library libbar.a and should be called baz in Lisp the following defining form is necessary:

(defextern baz (...) ... "foo")

To link the library libbar.a, put a copy of .eulrc.${ARCH} in your home directory and add -lbar to the list of $U2_LIBS; the library path must be given with -L<bar-path> in the list of $CFLAGS.

Automatic type conversion

The following automatic converters are available:

LispC (C99)
<fpi>int
<character>char
<double-float>double
<string>char*
booleanbool
ptrvoid*
<int*>int*
<double*>double*
<string*>char**

The ptr converter can be used to pass arbitrary C99 structures to Lisp, so that they can be passed back to C at a later stage. The ptr converter is also useful to pass a Lisp object unconverted to C99.

defextern

defextern definitions can not be linked dynamically.

DEFINTERN

Foreign in-calls have to use the DEFINTERN() syntax operator. Examples for in/out-calls to/from Lisp can be found in the directories Examples/Misc, Examples/Fortran, and Examples/C++.

Macro expansion

is un-hygienic.

EuLisp Scripts

Use #!../youtoo –script/ to write EuLisp scripts (see Examples/Misc/script.em).

Inter-operation with other languages

The examples in directory C++ and Fortran show how to interoperate with these languages.

List operators

Arithmetic functions +, - and / operate as set union, difference and intersection on lists.

Examples

Directory Examples contains modules for explanation and reuse.

Bindings

The current set of supported bindings in Youtoo are in the file bindings.txt

Modules

GNU Bignum: Modules/Bignum

Danius Michaelides wrote a port to the GNU bignum library (gmp).

MPI: Modules/MPI

Tcl/Tk: Modules/TclTk

Foreign thread libraries: Modules/Fthread

Matching: Modules/Match

Modulized version of match-slib.scm badly hacked for EuLisp.

Object serialisation: Modules/OS

includes support for closures and threads.

OPS5 rule-based system : Modules/OPS5

An object-oriented version of the OPS5 rule-based system.

Pipes and forked child processes: Modules/Pipe

Thanks to Rob Simmons there is support for pipes to forked child processes.

Bootstrapping

Building Youtoo from the EuLisp sources is termed “bootstrapping”. This requires a working installation which is used to compile the EuLisp source modules. The default directory path to the bootstrapping installation is ${EUL_DIR}.boot, i.e. .boot appended to the path of the current directory. Note that if the bootstrapping installation directory is renamed or moved the configure script should be executed in it after the move to correct the paths. The working directory can be “cleaned” for bootstrapping using make boot-clean and then the “bootstrapping” build process started with make boot. If all goes well a complete clean build will result.

This process allows changes and developments to be made to the Youtoo implementation of EuLisp.

Limitations

Currently the dependency analysis is not sufficient to cover all the possible ways in which the changes to the EuLisp modules in Youtoo interact and the rebuilds required to create a consistent Youtoo executable. Thus to be sure of success make boot-clean maybe required before every make boot.

Notes

The syntax files _.*0.em are used to enable the transition between old and new function names during the bootstrapping process. If functions change which affect the syntax files first change the non “_” versions, bootstrap-build then update the .boot version with the current, update the “_” versions to correspond to the non “_” versions and bootstrap-build again. This ensures a consistent final version.

Recent Developments

Support for 64bit Operation

The main change to support 64bit pointers is that on such architectures the Instruction is a 16bit integer rather than an 8bit char so that 4 Instructions still fit exactly in a pointer. This allows most of the stack pointer incrementing to remain unchanged. However, a very large number of small changes were also necessary. The C-files are compatible between the 32bit and 64bit versions.

C99 Compliance

The code is now C99 compliant and uses C99 data types and constructs so a C99 compiler is required e.g. gcc-4.?.?.

Rationalisation of the Makefiles

The Makefiles have been rationalised and simplified by using many features in the GNU version of make, gmake which is now required to build youtoo.

The start of the EuLisp-1.0 compliance process

Many small changes to improve consistency between the Youtoo implementation and the EuLisp-0.99 definition and the documents relating to the creation of EuLisp-1.0.

To Do

Something went wrong with that request. Please try again.