Giter Club home page Giter Club logo

gerku's Introduction

gerku

                     _,            
                    | |            
   __ _,  ___ ,_ __ | | __ _,  _,     /\___     
  / _` | / _ \| '__)| |/ /| | | |    (    @\___ 
 ( (_) |(  __/| |   |   ( | |_| |   /          )
  \_,  | \___)|_|   |_|\_\ \__,_|  /    (_____/ 
  __/  |                          (_____/    U  
 (____/ 

An interepreter for Concatenative Combinators as described in:

"The Theory of Concatenative Combinators by Brent Kerby" (link)

gerku started as sidekick project of mlatu to check if using stack based semantics would be equivalent to using rewriting rules. Given the type of rewriting rules mlatu is aiming to handle, the answer is NO!

mlatu is a project by Caden Haustein (carmysilna) (link)

gerku is now only aimed to be a tool for those wanting to explore the concatenative Combinatory Logic described in the Kerby's article.

Visit this channel on Discord to discuss and provide feedback.

Compile & Run

Clone (or fork) the repository on Github.

In the src directory just type make (tested on linux and on Windos MSYS2)

   prj/gerku/src> make
   prj/gerku/src> ./gerku

All dependencies are in the src/libs directory, all libraries used are by me except linenoise, a small, fast, self-contained, MIT-licensed, replacement of readline.

If the terminal you're using has issues with linenoise, you can change the settings in the makefile comment the line:

LINENOISE=-DUSE_LINENOISE

and recompile. You will lose history and line editing features.

Command line

gerku has few options that can be specified on the command line:

prj/gerku/src> ./gerku -h
GERKU 0.0.6-beta (C) 2021 https://github.com/rdentato/gerku
Usage: gerku [OPTIONS] ...
   -d file      Load definitions from the specified file
   -r           Run mode (no REPL)
   -v           Version

All arguments after the options are considered to be source files to be loaded and executed before entering the REPL. The directory grk has some example.

The REPL

The list of REPL commands is accessible within the REPL iteself:

prj/gerku/src> ./gerku
GERKU 0.0.6-beta (C) 2021 https://github.com/rdentato/gerku
Type ! for available commands.
|-> 
gerku> !
Available commands:
  !help              this help
  !list              list of defined words
  !load file         load definitions from file
  !save file         save definitions to file
  !print             print current stack
  !trace             toggle reduction tracing
  !quit              exit the repl
  !def ...           define a new word
  !del word | !all   delete a word [all words!]
  !wipe [auto]       wipe the stack [and toggles autowipe]
|-> 

Defining a combinator

A new combinator is defined through the "!def" command:

prj/gerku/src> ./gerku -h
./gerku -d
GERKU 0.0.6-beta (C) 2021 https://github.com/rdentato/gerku
Type ! for available commands.
|-> 
gerku> !def (@) (@) COMB = ((@1) @2)
|-> 
gerku> !list
        (@) (@) COMB = ((@1) @2)
|-> 
gerku> (x) (y) COMB
|-> ((x) y) 

Default combinators

By default gerku loads the definitions stored in grk/default.grk.

You can load a different definition file using the -d flag.

For example if you only want to load the primitive Kerby's combinators.

  prj/gerku/src> ./gerku -d grk/kerby.grk

gerku's People

Contributors

rdentato avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.