Fscratch

From Esolang
Jump to navigation Jump to search

Fscratch is a language made by herohamp in a website called Scratch.

Example programs

Print infinite ones (Not a truth machine)

c1,e1,o,g7,

Pi Calculator (by NitroCipher)

c1,e3,c3,e2,c4,e3,c5,e4,c6,ep3,mp4,mp5,c7,e4,dp6,c1,o,ap7,c3,a2,c4,a2,c5,a2,c6,ep3,mp4,mp5,c7,e4,dp6,c1,o,sp7,c3,a2,c4,a2,c5,a2,g23,

Fibonacci sequence (by NitroCipher)

c2,e1,c1,o,ap2,c2,o,ap1,g6,

Item data type

This language works with a data type I call "item", which can store a string or a number. So if a item variable has the value of 65 (the ASCII value that represents A), it's not the same as A.

The max number that an Item can store depends on the implementation.

A math operation with an Item is normal, except that you cant do 12 + h, you can only do math operations with numbers, same to detecting if something is greater than another or not.

Essentials

This language has the following rules:

  • Every instruction should end with a "," even the last one.
  • The memory is 128 items long.
  • There is a pointer pointing to a item in the memory, with that pointer you will modify the memory.
  • Every instruction is 1 character long.
  • To write an instruction, you use the following syntax:
    [instruction][paramether],
    Example:
    c5,

Instructions

Instruction Description
c Changes the pointer to the paramether
e Sets the item of memory pointed by the pointer to the paramether
g Goto the character specified by the paramether
f Goto the character specified by the paramether IF the item pointed by the pointer is not zero
a Adds paramether to the item pointed by the pointer
s Substracts the item pointed by the pointer to by the paramether
m Multiplies paramether to the item pointed by the pointer
d Divides the item pointed by the pointer by the paramether
o Will print the item pointed by the pointer, if its a number it will print that number

Notes

You can put a p at the right of an instruction, like this:

ep5,

If you put a p it will tell to the interpreter, that the parameter put, its a pointer to a memory location, and it will use that location instead of the number put in the parameter. It's basically indirect addressing.

Example

Your memory is this:

5, 3, 4, 3

and you do:

cp2,

It will set the pointer to 3 (the second item in the memory)

Another example

Your memory is this:

4, 3, 7, o, 6

and you do:

c1,ep5,

It will set the item 1 of the memory, to the fifth item in memory (6)

External resources

Reference and Interpreter