https://github.com/simonewebdesign/slfe
🍭 Sh***y Lisp Flavoured Erlang (LFE)
https://github.com/simonewebdesign/slfe
bytecode compiler elixir erlang interpreter language lfe lisp parser
Last synced: 21 days ago
JSON representation
🍭 Sh***y Lisp Flavoured Erlang (LFE)
- Host: GitHub
- URL: https://github.com/simonewebdesign/slfe
- Owner: simonewebdesign
- Created: 2016-10-22T11:41:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-21T09:44:54.000Z (almost 9 years ago)
- Last Synced: 2025-11-05T14:32:43.557Z (7 months ago)
- Topics: bytecode, compiler, elixir, erlang, interpreter, language, lfe, lisp, parser
- Language: Erlang
- Homepage:
- Size: 53.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SLFE [](https://travis-ci.org/simonewebdesign/slfe) [](https://coveralls.io/github/simonewebdesign/slfe?branch=master)
**SLFE** stands for **S**hitty [**LFE**](http://lfe.io/) ([LISP](https://www.common-lisp.net/)-flavoured [Erlang](http://www.erlang.org/)).
It's a new programming language based on [Elixir](https://github.com/elixir-lang/elixir) which aims to support all of the [`Enum`](http://elixir-lang.org/docs/stable/elixir/Enum.html) functionality.
## Overview
### The big picture
The `slfec` compiler is a program that takes a `foo.sl` source file and produces a `foo` executable binary.
The `isl` REPL is an executable interactive program/environment (like Ruby's `irb` and Elixir's `iex`) for `.sl` programs.
These tools do not exist yet, but that's how you would ideally use SLFE.
#### To-do list
- [x] Booleans
- [x] UTF-8 Strings
- [x] Integers
- [ ] Floats
- [x] Multiple statements
- [x] `if` expressions
- [x] Equality checks with `==` and `/=`
- [x] Functions
- [x] Math operators (`+`, `-`, `*`, `/`)
- [x] Linked lists
### Code walk-through
This project is currently composed of 4 files:
#### Erlang
- src/lisp_lexer.xrl - Lexical analyzer generator
- src/lisp_parser.yrl - LALR-1 Parser Generator
#### Elixir
- lib/lisp_parser.ex - Layer on top of `:lisp_lexer` and `:lisp_parser`
- lib/lisp_evaluator.ex - Evaluates s-expressions and writes to stdio. Ideally the two things should be decoupled.
### Running the test suite
You can do so by running `mix test` from the command line.
$ mix test
............................
Finished in 0.07 seconds
28 tests, 0 failures
## FAQ
Should I use this?
Probably not. This is actually just an experiment, so I wouldn't recommend people using it to build actual programs. But feel free to use it anyway if you want.
Why Erlang/Elixir?
[`leex`](http://erlang.org/doc/man/leex.html) and [`yecc`](http://erlang.org/doc/man/yecc.html) are the powerful Erlang alternatives to [`lex`](http://en.wikipedia.org/wiki/Lex_(software)) and [`yacc`](https://en.wikipedia.org/wiki/Yacc). I like Erlang, and Elixir is pretty rad too. So why not?
Is SLFE a Turing-complete language?
Yeah, I guess.
---
**SLFE** was inspired by [this blog post](http://andrealeopardi.com/posts/tokenizing-and-parsing-in-elixir-using-leex-and-yecc/) (thanks Andrea!).
Kudos to [lpil](https://github.com/lpil) for the name suggestion and for being awesome.