/lfe

Lisp Flavoured Erlang (LFE)

Primary LanguageErlangApache License 2.0Apache-2.0

LFE

LFE, Lisp Flavoured Erlang, is a lisp syntax front-end to the Erlang compiler. Code produced with it is compatible with "normal" Erlang code. An LFE evaluator and shell is also included.

Important Note

A quick fix has been added to compensate for some incompatibilites in Core Erlang between the old R12B and the new R13B. The fixes are found in the file lfe_codegen.erl. For one fix code must be chosen depending on whether the systems runs on R12B or R13B, this is the (tiny) function c_fname/3 near the end of the file. Choose the right version of the function. The .beam file in ebin is for R13B.

I will try to make a better fix soon. Sorry about that.

Version History

v0.7

Added Travis-CI support. You can use this .travis.yml and add lfe to http://travis-ci.org. (Ward Bekker)

First version of Query List Comprehensions.

Add access to current macro environment through the variable $ENV within macros which allows explicit macro expansion.

First version of match-specification generator.

Add ets/mnesia match patterns to records.

Arithmetic functions + - * / and comparison functions > >= < =< == /= =:= =/= now take multiple arguments. This is experimental and as yet only implemented as macros.

Handle compiler option warnings_as_errors in the same way as the vanilla Erlang compiler.

Improved ++ macro; it can now be used in patterns.

List/binary comprehensions generate fewer unnecessary compiler warnings.

Added new example file with core macros implemented in LFE.

New patterns with explicit constructors! We now follow the invariant that constructors and patterns should look the same. It is still possible to use old patterns but cons and list are now "reserved words" like tuple and binary.

Allow guards with generators in list/binary comprehensions. N.B. can cause unexpected behaviour with binary generators.

v0.6

Allow literal strings in binaries, both as plain values and as values with specs, so (binary "abc" ("åäö" utf-8)) is valid. In the second case the spec is applied to each character. Works with lists as well. Add big, little and native as synonyms to big-endian, little-endian and native-endian.

Now have working Makefile, Emakefile and .app file.

Guards are now a sequence of tests, (when test test ...). The structure of guard tests has been fixed and is now more logical as tests. For example (if ...) is now allowed.

Add temporary fix to ensure that guards are compiled correctly. It is less efficient but should be correct. It will be removed when no longer necessary.

Read and output based integers.

Improve prettyprinting of defuns.

Many internal improvements.

v0.5

Added macro list*.

Added a new shell command to set variables in the shell.

Cleaned up compiler options and made them more like the vanilla compiler.

Added unicode types to binaries: utf-8, utf-16 and utf-32.

Shell and compiler now print error data in LFE instead of vanilla. Shell error reporting is still pretty basic, not as "beautiful" as vanilla.

Cleaned up i/o functions and added formatted output function. It still uses vanilla command characters.

All i/o goes through the module lfe_io````. The functions which return the corresponding printable string end in 1. So lfe_io:formatprints formatted output whilelfe_io:format1``` returns the string.

Improved pretty-printing.

Many internal improvements.

v0.4

This will be the last development version for Erlang R12B-5 and older, all future development will for R13B. If there is enough interest I may start a separate branch for R12B.

Parameterized modules.

Added (export all) attribute to module definition.

Added new records which allow giving default values as in vanilla Erlang. Records are still compatible with vanilla Erlang but now more pratical to use. NOTE this change is not backwards compatible as syntax for (make- ...) and (match- ...) have changed. Also added general multiple (set- ...) macro.

(eval-when-compile ...) added as a top-level form which allows functions to be defined when compiling the forms. These are useful for more complex macros.

Better and more documention. The documentation is still normal text files as Edoc and are not in agreement on how things should work.

v0.3

This is the first version with the modified internal core forms and macro intefaces for the new CL-inspired style and the older Scheme-inspired style.

Two new modules have been added:

lfe_boot allows you start Erlang with the LFE shell running and still have ^G enabled and user_drv running. Use it as follows:

erl -noshell -noinput -s lfe_boot start

NOTE order of commands important, must be -noshell -noinput! Add -pa to find modules if necessary.

lfe_gen is a trial interface for using LFE for dynamic code generation. LFE is much easier to generate as an Erkang list than Erlang forms. This module helps with defining and compiling a module. Note, that while it works, this module is very experimental and may change.