# Sophie

Sophie (Hebrew for "Finite") is an esoteric programming language created by User:Oshaboy. It is designed to be equivalent to a Finite State Automaton because Finite State Automata are underappreciated. Technically everything in our finite universe is a Finite State Machine

## Overview

The language has a single accumulator that can store integers. You cannot add or subtract from the accumulator or store it anywhere. You can only assign it constants and check its value. The accumulator should be unbounded. But anything 16 bits and up should be plenty.

[] - loop until break * - break loop . - output accumultor as number : - input number to accumulator , - output accumulator as char ; - input char to accumulator @c{}{} - if accumulator is c, do the first {} otherwise do the second {} (second {} optional) @$n{}{} - if accumulator is n, do the first {} otherwise do the second {} #c - load char constant c into accumulator #$n - load number constant n into accumulator & - halt

Brackets without a condition will never get run. This can be used for comments.

{This is a comment}

## Computational Class

A Finite State machine can be converted to a Sophie script using an infinite loop where the accumulator when it enters the loop determines the state. A big "if elif else" can run code based on the state.

However it is not Turing Complete because you can solve the halting problem for any given Sophie program. Run the program until it either halts or enters a loop with the same accumulator value (which occurs if and only if it loops forever). It might be a pushdown automaton but I doubt it.

## Examples

Hello World

#H,#e,#l,,#o,#,,# ,#W,#o,#r,#l,#d,#!,&

Truth Machine

;@1{[,]}{,&}

Cat Program

[;@$0{&}{,}]

Xor Program

:@$0{:@$0{#0,}{#1,}}{:@$0{#1,}{#0,}}&