Hsamsniarb

From Esolang
Jump to navigation Jump to search

Hsamsniarb is a joke programming language you can't even create a "Hello, World!" program in. (Hsamsniarb is Brainsmash backwards.)

Overview

The language combines elements from Deadfish and brainfuck, in particular the former.

Following its interpreter's invocation, an initial program may be introduced by some advenient avenue, for instance the command line or an argument to the evaluating routine.

Proceeding from this first stage, a perpetual iteration is instigated, the same repeatedly queries the standard input for a single character, preceded by the prompt message >> , which is subsequently evaluated.

Architecture

Hsamsniarb's architecture is developed, siclike to the syntactical and operational aspects, as an amalgam of Deadfish and brainfuck.

The entire memory comprehends a single entity, a register whose capacity amounts to an unsigned byte scalar, occupying the integer interval [0, 255], and assuming the value zero (0) at the program's inchoation. Upon any of its two bourne's transgressions, the state returns to its default of zero.

The register constitutes an appropriation from Deadfish, while its octet size most likely originates in brainfuck.

Commands

An aperçu shall educate about the language's quadruple command set, the same encompasses basic arithmetics and an output facility. Non-command content is simply ignored, and does not, as is the wont of Deadfish, produce a newline display.

Hsamsniarb Effect
+ Increments the register by one. If the new value exceeds 255, the register is reset to 0.
- Decrements the register by one. If the new value descends below 0, the register is reset to 0.
s Squares the register's value. If the new value exceeds 255, the register is reset to 0.
w Prints the register value in its verbatim numeric form to the standard output on a line of its own.

Hsamsniarb and Deadfish

Hsamsniarb's descendance from Deadfish permits an equiparation of their operational facilities:

Hsamsniarb Deadfish
+ i
- d
s s
w o

Interpreters

The only current interpreter is made in Visual Basic.

Option Explicit On
Option Strict On
Module Module1
    Dim val As Integer = 0
    Sub Main()
        Dim code As String = ""
        Try : code = My.Computer.FileSystem.ReadAllText(Command().Trim(""""c))
        Catch : End Try
        For Each C As Char In code
            Interpret(C)
        Next
        While True
            Console.Write(">> ") : Interpret(Console.ReadKey.KeyChar)
        End While
    End Sub
    Sub Interpret(ByVal C As Char)
        Select Case C
            Case "+"c : val += 1 : Console.WriteLine()
            Case "-"c : val -= 1 : Console.WriteLine()
            Case "w"c : Console.WriteLine() : Console.WriteLine(val.ToString())
            Case "s"c : val = CInt(val ^ 2) : Console.WriteLine()
        End Select
        If (val < 0) Or (val > 256) Then val = 0
    End Sub

End Module
  • Common Lisp implementation of the Hsamsniarb programming language.