# Grass

Grass is a functional grass-planting programming language. Its unique characteristics is sakd to be easy to slip into ASCII art.

Grass is based on lambda calculus, and the program consists of a list of abstractions and applications of functions, using only the characters: W w v

## Overview

The following six characters are valid characters for Grass, and others are ignored： v, w, W, ｖ, ｗ, and ｗ. The three full-width characters are semantically identifical to each corresponding half-width character. Program of Grass is considered to be a sequence of functions. v is considered to be token-separator, tokens beginning with w is abstruction and W is application.

Grass has a SECD machine as a virtual machine, and it runs program. Its envorinment is initialized with four primitive functions: Out, Succ, integer 119 (or character 'w'), and In.

The Out function takes one argument (must be integer or aborted) to output the value as ASCII character. The Succ function takes one argument (must be integer, let it be ${\displaystyle n}$) to return ${\displaystyle (n+1)\%256}$. Integer can be both argument of functions and function. As a function use, it takes one argument to return if the integer value and that of its argument are identifical, in Church boolean (${\displaystyle \lambda xy.x}$ and ${\displaystyle \lambda xy.y}$ for true and false respectively). The In function takes one argument, then reads a character from stdin to return the value if succeeded, or argument itself if reached to EOF.

## Examples

The following code prints single 'w'.

wWWwwww


The following code prints 'w' forever.

無限に草植えときますねｗＷＷｗｗｗｗＷＷｗｗ


The following code calculates 1+1 and prints the result, as number of 'w's.

wwWWwv
wwwwWWWwwWwwWWWWWWwwwwWwwv
wWWwwwWwwwwWwwwwwwWwwwwwwwww