Coder Social home page Coder Social logo

catseye / beatnik Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 2.0 11 KB

Cat's Eye Technologies' implementation of (and tools for) the Beatnik programming language

License: The Unlicense

Python 100.00%
esolang esoteric-programming-language esoteric-language beatnik beatnik-language interpreter

beatnik's Introduction

Beatnik

This is Cat's Eye Technologies' distribution of tools for Cliff L. Biffle's Beatnik programming language. This includes an interpreter for Beatnik, some example Beatnik programs, a compiler from a wimpmode dialect called Wottasquare, and various small utilities which can (for example) search a dictionary file for all words with a given Scrabble score.

All tools are written in Python and located in the scripts directory. You may wish to cd to this directory to run them, or put this directory on your executable search path.

beatnik.py

Basic usage:

beatnik.py (filename.beatnik|--eval 'Beatnik program source')

Interprets the Beatnik program in the given source file, or, if the --eval flag is given, the Beatnik program in the command line.

It considers the program to be written in Beatnik at face value. That is to say, it interprets the Beatnik specification as containing no errors, even though the author claims there is an error in it and won't divulge where. Don't expect this interpreter to work on the example programs supplied with the specification.

This interpreter seems to have the same behaviour as Catatonic Porpoise's Beatnik interpreter. This repository could stand to contain some test cases, though.

beatnik.py also takes a --debug flag, which dumps some internal state to standard error as the program is run.

beatnik.py also takes a --tokenize flag, which prevents the program from being run, and instead dumps a representation of the program in Wottasquare to standard output. (It is essentially a Beatnik-to-Wottasquare compiler.)

The following idiom can be used to find out what Scrabble score, and thus what Beatnik instruction, a particular word has.

$ beatnik.py --tokenize --eval 'Twenty'
[12:DUP/Twenty]

wottasquare.py

Basic usage:

wottasquare.py [--dictionary filename] filename.wottasquare

Reads the Wottasquare program from the given file and compiles it to an equivalent Beatnik program on standard output.

The Wottasquare language has the same semantics as the Beatnik language, but each token has the form [n:comment] where n is the Scrabble score, given in decimal, and comment is optional, purely descriptive, and ignored by translation tools such as this one.

Thus, the Wottasquare token [5] could be translated to any word which has a Scrabble score of 5, such as slug, for use in Beatnik.

By default, wottasquare.py looks in /usr/share/dict/words for words to use when translating Wottasquare to Beatnik. A different dictionary file can be specified with the --dictionary command-line argument. Note that the dictionary file is parsed like a Beatnik source file would be; punctuation is ignored (and treated as word seperator), etc.

There are two flags which trigger special behaviour:

wottasquare.py --find 'number-or-word'

Shows the Scrabble score of the given word (or treats the given argument as a Scrabble score, if it is numeric,) then dumps, to standard output, 20 words chosen from the dictionary file which have the same Scrabble score as the given word. Examples:

$ wottasquare.py --find chase
10
cubits badger gourmet pointers militant acumen engorges rehab fulled bibles bonny wantons motored blasters colossus warder howl colonial mainline frailer

$ wottasquare.py --find 5
5
nip rode sitar lisle stilt uteri slug stain stool earls terns cot liter stout lob lab trots lotus altos boo

The flag --find-all works similarly, but dumps all words from the dictionary with the given Scrabble score to standard output.

make-wottasquare-print.py

Takes a string on the command line and writes, to standard output, a Wottasquare program which, when run, prints that string. It does not produce the most efficient such program.

This tool was used to generate eg/hello-world.wottasquare, which was then translated to Beatnik by wottasquare.py, which was then manually formatted and punctuated, with some (maybe 3%) words "adjusted" to make it flow better.

License

The contents of this repository are in the public domain. See the file UNLICENSE in this directory for more information.

beatnik's People

Contributors

angel-carvajal-coder avatar cpressey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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