CreativeScript

From Esolang
Jump to navigation Jump to search

CreativeScript is a esolang made by Mihai Popa. It's the "succesor" of mLang. While mLang reads 1 line only from arguments, CreativeScript reads the full program from a file!

Macro List

There are only 4 macros. This is the list:

Macro list
Macro What it does
say! Prints a line of text
set! Sets a variable to a value
add! Adds two numbers
out! Prints a variable

Note

The file extension for CreativeScript (*.cs) should not be confused with C# files. They are not the same.

Examples

Hello, world!

say! Hello, world!

Number 5

set! hello 5
say! The number is:
out! hello

XKCD Random Number

set! xkcd 4
say! The number is:
out! xkcd

A+B Problem

add! 5 10 z
out! z

Replace 5 and 10 by the numbers you want to add.

Interpreter

Is in Batch! Run it as follows:

CreativeScript.bat hello.cs

Replace "hello.cs" with the name of the program you want to run.

@echo off
for /F "tokens=1,2,3,4* delims= " %%a in (%1.cs) do (
  if %%a EQU say! (
    echo %%b %%c %%d
  )
  if %%a EQU set! (
    set %%b=%%c
  )
  if %%a EQU add! (
    set /a %%d=%%b+%%c
  )
  if %%a EQU out! (
    echo echo %%%%b%%% >> tmp.bat & tmp.bat & del tmp.bat
  )
  if %%a NEQ say! if %%a NEQ set! if %%a NEQ out! if %%a NEQ add! (
    echo E01: Macro not valid.
	echo Backend expection: %%a
	echo                    ^^
	echo                    ^| [HERE]
  )
)

See also