An esoteric programming language that supports concurrency, regex, and web requests.

Overview

The Hofstadter Esoteric Programming Language

Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.

The Hofstadter esoteric programming language executes every line concurrently, in round-robin style. There are only 8 commands and each line can only store a single string value.

The commands are as follows:

Action Example code Description
HTTP request http://www.austinhenley.com If the line's data is empty, performs a HTTP GET at the specified URL and stores the result in data. If the line's data is not empty, performs a HTTP POST at the specified URL with the line's data as the request's body and stores the response in data.
Regex "a(bc)*" Runs the specified regex on the line's data and stores the first match back in the line's data.
File IO foo.txt If the line's data is empty, reads the specified file's contents to the line's data. If the line's data is not empty, writes the line's data to the specified file. Can be a relative or absolute path.
Console IO ; If the line's data is empty, reads from stdin into the line's data. If data is not empty, write tp stdout.
Conditional ?5 If the line's data is equal to the specified line's data, continue. Else, restart the execution of this line from the start but keep the data.
Conditional !5 If the line's data is not equal to the specified line's data, continue. Else, restart the execution of this line from the start but keep the data.
Swap data @5 Swaps the line's data with the specified line's data.
Concatenate +5 Concatenates the line's data with the specified line's data and stores it in the line's data.

Lines are 1-indexed. You can swap with lines that do not exist as extra storage (but they must be positive numbers). Line 0 always contains the empty string, no matter what you swap to it (@0 is effectively a clear). When lines restart or end, they retain their value. Commands are expected to be space separated.

Example: Counting to 99.

Todo.

Example: Two digit adder.

Todo.

Comments
  • stdin/stdout character inconsistency

    stdin/stdout character inconsistency

    In the documentation, it is stated that ; represents the Console IO character. In the source code, hofstader.py lines 39-41 tokenize # as the "stdin/stdout" token. As such, current evaluation computes ; as a filename. Either the documentation should be updated to reflect that # is the appropriate operator, or the code should be changed to evaluate ; as the console operator.

    opened by gcrois 1
  • Wrong Symbol for Console IO

    Wrong Symbol for Console IO

    https://github.com/AZHenley/hofstadter/blob/1c30c61a8b22e38b86b6883e618dea7b27e63692/hofstadter.py#L38-L41

    In the above lines from the interpreter, the symbol for console io is denoted by #. Either the documentation should be updated to reflect that or the interpreter should be updated to be consistent with the documentation.

    opened by M9909-AB 1
  • Peanut Allergy Compliant Strings

    Peanut Allergy Compliant Strings

    This program takes in a string from the user and removes all instances of the word "peanut" from the string in order for people with a peanut allergy to be able to read the string.

    NOTE: The program will automatically try to read from a non-existing file in order to close and stop the program. If the user inputs an empty string or one without "peanut" in it then you must manually close the program using ctrl-c.

    To Use: Run the program and enter a string of your choice that may or may not contain the word peanut and then hit the enter key. The program will then output the same string that was given just without peanut in the string. For example, you could type in:

    • "Hello world." and the output would be: "" because the string does not need to be changed.
    • "Hello peanut world." and the output would be: "Hello world."
    opened by Thalomir 0
  • 3 single-digit sort

    3 single-digit sort

    NOTE: must manually quit the program after sorted input prints (ctrl-c/keyboard interrupt). Couldn't find a way to exit the program gracefully.

    How to use: Type in 3 single-digit numbers (0-9) one line at a time. Example: 6 1 7

    After hitting return/enter on the third input, the numbers will be printed out in numerical order. At this point, you must manually quit the program. I spent a while trying to figure out how to exit, but I haven't figured out a solution yet.

    opened by mmathur20 0
  • 3 Digit Adder

    3 Digit Adder

    Takes 3 numbers and adds them together, printing the result. Tested for every combination of 0-9, undefined functionality for inputs outside those characters

    Notes: Prevents lines from fully executing and getting frozen by putting !0 ?0 at the end. Some lines would get stuck if they began with ?<line>, not sure why but they were fixed with a swap to themselves. Works by counting down one input number at a time while simultaneously counting up the output. Expects const.txt to be in the directory where it is called. Exits by trying to read the non-existent file --.

    Execution order / branching was forced by the following process:

    • Have a line that is otherwise empty to hold an 'event' that marks the start of this group running
    • Following 2+ lines begin with the same process of wiping, then concatenating the event
    • If the event is active, wipe then concatenate what you are comparing against
    • Each line must vary from this point by having mutually exclusive comparators, like ?<line> and !<line> or ?<line1> and ?<line2>
    • Have the branch do some operations
    • Wipe the event and write to the line corresponding to the next branch / event
    • I varied this process slightly in my program by having the event line do the reading for the comparator, then adding a not conditional against the event symbol.
    opened by lukepmccombs 0
  • Add __name__ check to allow for import

    Add __name__ check to allow for import

    Most useful programs written in hofstadter will likely need some setup and cleanup utilities -- adding a __name__ check would allow for programmers to 'elegantly' import hofstadter into a python script which encompasses setup, execution, and cleanup.

    opened by gcrois 0
  • Conditional Error (hofstadter.py:76)

    Conditional Error (hofstadter.py:76)

    Error:

    Traceback (most recent call last):
      File "/home/cade/programs/hofstadter/hofstadter.py", line 221, in <module>
        evaluator = Evaluator([Line(x) for x in rawlines])
      File "/home/cade/programs/hofstadter/hofstadter.py", line 221, in <listcomp>
        evaluator = Evaluator([Line(x) for x in rawlines])
      File "/home/cade/programs/hofstadter/hofstadter.py", line 17, in __init__
        self.tokenize()
      File "/home/cade/programs/hofstadter/hofstadter.py", line 23, in tokenize
        t = self.nextToken()
      File "/home/cade/programs/hofstadter/hofstadter.py", line 76, in nextToken
        while not self.text[self.index].isspace() or escaped and self.index < length:
    IndexError: string index out of range
    

    https://github.com/AZHenley/hofstadter/blob/main/hofstadter.py#L76 has the conditional checks out of order, it change from:

                while not self.text[self.index].isspace() or escaped and self.index < length:
    

    to:

                while self.index < length and not self.text[self.index].isspace() or escaped:
    
    opened by cadebrown 0
Owner
Austin Henley
Assistant Professor at University of Tennessee researching software engineering and human-computer interaction with a focus on developer productivity.
Austin Henley
NORETURN is an esoteric programming language, based around the idea of not going back

NORETURN NORETURN is an esoteric programming language, based around the idea of not going back Concept Program coded in noreturn runs over one array,

null 1 Dec 15, 2021
A gamey, snakey esoteric programming language

Snak Snak is an esolang based on the classic snake game. Installation You will need python3. To use the visualizer, you will need the curses module. T

David Rutter 3 Oct 10, 2022
A partial-transpiler that converts a subset of Python to the Folders esoteric programming language

Py2Folders A partial-transpiler that converts a subset of Python to the Folders esoteric programming language Folders Folders is an esoteric programmi

Daniel Johnson 1 Dec 23, 2021
Binary++ is an esoteric programming language based on* binary

Binary++ is an esoteric programming language based on* binary. * It's meant to be based on binary, but you can write Binary++ code using different mea

Supercolbat 3 Feb 18, 2022
An implementation of an interpreter for the Brainfuck esoteric language in Python

Brainfuck Interpreter in Python An implementation of an interpreter for the Brainfuck esoteric language in Python. ?? The Brainfuck Language Created i

Carlos Santos 0 Feb 1, 2022
A ULauncher/Albert extension that supports currency, units and date time conversion, as well as a calculator that supports complex numbers and functions.

Ulauncher/Albert Calculate Anything Ulauncher/Albert Calculate Anything is an extension for Ulauncher and Albert to calculate things like currency, ti

tchar 67 Jan 1, 2023
A Regex based linter tool that works for any language and works exclusively with custom linting rules.

renag Documentation Available Here Short for Regex (re) Nag (like "one who complains"). Now also PEGs (Parsing Expression Grammars) compatible with py

Ryan Peach 12 Oct 20, 2022
This is a survey of python's async concurrency features by example.

Survey of Python's Async Features This is a survey of python's async concurrency features by example. The purpose of this survey is to demonstrate tha

Tyler Lovely 4 Feb 10, 2022
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent Of Code 2021 - Python English Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels th

Coral Izquierdo Muñiz 2 Jan 9, 2022
This tool helps you to reverse any regex and gives you the opposite/allowed Letters,numerics and symbols.

Regex-Reverser This tool helps you to reverse any regex and gives you the opposite/allowed Letters,numerics and symbols. Screenshots Usage/Examples py

x19 0 Jun 2, 2022
ripgrep recursively searches directories for a regex pattern while respecting your gitignore

ripgrep (rg) ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. By default, ripgrep will resp

Andrew Gallant 35k Dec 31, 2022
A way to write regex with objects instead of strings.

Py Idiomatic Regex (AKA iregex) Documentation Available Here An easier way to write regex in Python using OOP instead of strings. Makes the code much

Ryan Peach 18 Nov 15, 2021
PyGo custom language, New but similar language programming

New but similar language programming. Now we are capable to program in a very similar language to Python but at the same time get the efficiency of Go.

Fernando Perez 4 Nov 19, 2022
FBChecker Account using python , package requests and web old facebook

fbcek FBChecker Account using python , package requests and web old facebook using python 3.x apt upgrade -y apt update -y pkg install bash -y pkg ins

XnuxersXploitXen 5 Dec 24, 2022
✨ Udemy Coupon Finder For Discord. Supports Turkish & English Language.

Udemy Course Finder Bot | Udemy Kupon Bulucu Botu This bot finds new udemy coupons and sends to the channel. Before Setup You must have python >= 3.6

Penguen 4 May 4, 2022
Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls

guess-the-numbers Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls Number guessing game

Amir Hussein Sharifnezhad 5 Oct 9, 2021
Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls

password-generator Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls Password generator

Amir Hussein Sharifnezhad 3 Oct 9, 2021
This repository containing cross-section cut and fill calculations using Python programming language.

cross-section This repository is containing cut and fill calculations for cross-section using Python programming language. This codes is made to calcu

null 3 Jun 15, 2022
The worst and slowest programming language you have ever seen

VenumLang this is a complete joke EXAMPLE: fizzbuzz in venumlang x = 0

Venum 7 Mar 12, 2022