Record

From Esolang
Jump to navigation Jump to search

Record (Regex concatenate read display) is an esolang invented by User:None1.

Memory

It uses string variables. Reading a non-existent variable results in an empty string. Storing in a non-existent variable creates it.

String and RegEx

String literals and RegEx style depend on implementation

Commands

Commands are case sensitive.

  • RE a r s v1 v2 ... tries to match s with RegEx literal r. If it fails then jump to line a (1-indexed, jumping out of bounds halts), otherwise captures to v1 v2 ...
  • CO v1 s1 concatenates v1 with s1 and stores the result in v1.
  • R v reads a line to variable v.
  • D s prints s with nothing after it.

Examples

The following examples use Python-styled string literals and RegEx.

Hello, World!

D "Hello, World!"

Unary A+B

R a
R b
CO a b
D a

XKCD Random Number

D "4"

Check if input is a number string

R a
RE 5 "(\\d*)" a b
D "Yes"
RE 6 "a" "b"
D "No"

You can see that RegEx is parsed as string literals first and then RegEx.

Cat program

R a
D a