Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
An attempt to understand how Grass (esolang) works.
#1
description

The following program is said to output a single 'w'.

Code:
wWWwwww

Syntax check
wWWwwww
w and WWwwww: <abs>
WW and wwww: <app>

Compile
Perhaps the program's C_0 is represented as: C_0=Abs(1, C)::nil where C=App(2, 4)::nil.
...?

original description Wrote:I ::= App(n, n) | Abs(n, C)

Well, whatever. Let C_0 be Abs(1, App(2, 4)::nil)::nil.

Transformation

(C_0, E_0, D_0)
= (Abs(1, App(2, 4)::nil)::nil,
   Out::Succ::w::In::nil,
   (App(1, 1)::nil, nil)::(nil, nil)::nil)
     = (Abs(n, C')::C, E, D) -> (C, (C', E)::E, D) (because n=1)
= (nil,
   (App(2, 4)::nil, Out::Succ::w::In::nil)::Out::Succ::w::In::nil,
   (App(1, 1)::nil, nil)::(nil, nil)::nil)
     = (nil, f::E, (C', E')::D) -> (C', f::E', D)
= (App(1, 1)::nil,
   (App(2, 4)::nil, Out::Succ::w::In::nil)::nil,
   (nil, nil)::nil)
     = (App(m, n)::C, E, D) -> (C_m, (C_n, E_n)::E_m, (C, E)::D)
        where E = (C_1, E_1)::(C_2, E_2):: ... ::(C_i, E_i)::E' (i=m,n)
= (App(2, 4)::nil,
   (App(2, 4)::nil, Out::Succ::w::In::nil)::Out::Succ::w::In::nil,
   (nil, (App(2, 4)::nil, Out::Succ::w::In::nil)::nil)::(nil, nil)::nil)
     = (App(m, n)::C, E, D) -> (C_m, (C_n, E_n)::E_m, (C, E)::D)
        where E = (C_1, E_1)::(C_2, E_2):: ... ::(C_i, E_i)::E' (i=m,n)


At this point I am stuck now. I know (C_2, E_2) is Out and (C_4, E_4) is w at this point.
But what do you mean by C_2 and E_2 respectively?

= (C_2,
   w::E_2,
   (nil, (App(2, 4)::nil, Out::Succ::w::In::nil)::Out::Succ::w::In::nil)
      ::(nil, (App(2, 4)::nil, Out::Succ::w::In::nil)::nil)
      ::(nil, nil)
      ::nil))


Does anyone get it how it goes after? Can anyone explain us how Grass works?
Reply
#2
ok
My avatar comes from https://thegamercat.com/
Reply
#3
Well, I was looking for anyone who got it, kinda seriously.
Reply




Users browsing this thread: 1 Guest(s)