Марковский

From Esolang
Jump to navigation Jump to search

Марковский (or Markovskiy) is an esoteric programming language created by User: LolloDev5123 designed to operate using a Markov algorithm. In Марковский, programs consist of a series of "states" that are transformed by a set of rules.

Overview

Марковский programs consist of a series of states that are transformed by a set of rules. Each rule is a conditional statement that checks for the presence or absence of certain symbols in the current state and specifies a replacement string that should be used if the condition is met. The program starts in an initial state and applies the transformation rules to the current state, checking after each rule is applied whether the resulting state is a "halt state" that should cause the program to terminate.

Syntax

Марковский programs consist of a series of state definitions, each of which consists of text that represents the state. The syntax for a state definition is as follows: state "Hello world!"

Rules are defined using conditional statements that check for the presence or absence of certain symbols in the current state and specify a replacement string if the condition is met. The syntax for a rule is as follows:

condition -> replacement

The condition is a sequence of symbols that must be present or absent from the current state in order for the rule to be applied. The replacement is a string of symbols that should be used to replace the matching sequence if the condition is met.

For example, the following rule replaces any occurrence of the letter "A" with the letter "B":

A -> B

A program can have any number of rules. The rules are applied to the current state in the order in which they are listed until a halt state is reached.

Execution

To execute a Марковский program, the program is loaded into the interpreter and executed. The interpreter starts by reading the initial state and then applies the transformation rules to the current state. The program terminates and outputs the final state when all rules have been applied.

Hello world!

"" 
_ -> Hello, World!

This program defines an initial state that is empty, and then has a rule that checks for the presence of any symbol (represented by the underscore character, a wildcard in Марковский) in the current state. If a symbol is present, the program replaces the current state with the string "Hello, World!" and terminates.

Quine

state "a -> aq"
q -> q

The program starts in the initial state, which contains the string "a -> aq". The first rule replaces any occurrence of "q" with the string "q", effectively doing nothing. The program halts when there are no more rules that can be applied, leaving the final state as the original source code.