Skip to content

pidhii/ether

Repository files navigation

!!! IMPORTANT !!!
Documentation of the language on my wiki is outdated. I hope to update it. But developement is still quite rapid so I dont know if it would make sence.

General:

  • REPL
  • Packet manager (dope)

Features:

  • Pattern matching
  • Closures
  • Variant-types
  • Lightweight record-types
  • Persistent tables ...some more flexible dictionary-like thing
  • Classes ...for the sake of inheritance
    • Named classes
    • Objects of unnamed classes
  • Tuples
  • Persistent vectors
  • Regular expressions
  • Macros
    I want it to be something derived from Lisp.
  • User-defined operators
    • redefinition of builtin operators
    • allow definition of new operators
    • precedence for user-defined operators
  • Named arguments
    Can try to exploit records as reading multiple values is quite efficient with them.
  • Exceptions
  • Modules
  • Coroutines
  • Multiple return-values (like in Lua)
  • Ability to enter REPL at break-points (for debug)
  • Type constrains ...whatever it means.
    Need a tool to check signatures (arity + return-value) of functions.
    Easy to implement via language itself but it should have some dedicated syntax + care about performance.

Syntax:

  • simplyfied syntax for loops
  • match like in Caml
  • "do-natation" for monads?

  • Fuck Python, I'm the queen
  • Smart reference counting
  • Capture unpacked fields if available
  • Unpack structs outside closure (if applicable)
  • Inline small functions at first pass
  • Dynamic optimization
    • inline captures
    • branch prediction?
  • Detect fixed values in loops
  • JIT compilation
  • Propagate type information when possible
    • intrinsic operators
    • constructors
    • functions
      • C functions
      • closures
  • Merge sequential unpacks (if applicable)
  • Smaller instructions
  • Delay lambda constructors (when used conditionaly)

Build and install with CMake.
Debug and Release build types are supported.

To build Release configuration do

  • create directory for temporary files:
    $ mkdir build
  • run CMake to generate build-scripts:
    $ cmake -D CMAKE_BUILD_TYPE=Release \ # we want Release-configuration
            -D CMAKE_INSTALL_PREFIX=<where-to-install> \
            -B build \                    # temporary directory for a build
            -S .                          # path to Ether sources
  • build and install (we are using GNU Make here):
    $ make -C build install
  • additionaly you can run some tests:
    $ make -C build test 
  • now you can add Ether to your system environment:
    $ prefix=<full-path-to-installation-directory>
    $ export PATH=$prefix/bin:path
    $ export PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+${PKG_CONFIG_PATH}:}$prefix/lib/pkgconfig
    or you can use env.sh to setup environment in current shell:
    $ source env.sh <path-to-installation>

To run Ether in interactive mode just run it straightaway:

$ ether
Ether REPL
version: 0.2.0
build: Release
build flags:  -Wall -Werror -Wextra -Wno-unused -Wno-error=cpp -rdynamic -O3 -DNDEBUG
prefix: /home/pidhii/sandbox/create/ether/Release/install

Enter <C-d> (EOF) to exit
Commands:
  '.'                   to reset input buffer (cancel current expression)
  '.help'               show help and available commands
  '.help <ident>'       show help for given identifier
  '.complete-empty'     display all available identifiers when completing empty word
  '.no-complete-empty'  disable effect of the previous command

>

Note that some syntacticly valid expressions will not work for REPL. It is due to "machanisms" of REPL are different to those applied to script processing.

As you may have noticed, ether syntax is wery similar to ML's one, so generaly you can just set your editor to treat it like OCaml for examle. However there are differences, and some of ether-only expressions tend to appear very often in the code (e.g. if let <pattern>).

Vim

I'm maintaining native syntax configuration only for Vim (not familiar with other editors). See ether-vim for the plugin. You can install with pathogen.

To make Vim recognise ether scripts you can add following line to your .vimrc:

autocmd BufRead,BufNewFile *.eth set filetype=ether syntax=ether

If you use NERDCommenter you can also add:

let g:NERDCustomDelimiters = {
  \ 'ether': { 'left': '--', 'leftAlt': '--[[', 'rightAlt': ']]', 'nested': 1 }
  \ }

This world is cruel.

Just joking =)