dongbei

From Esolang
Jump to navigation Jump to search

dongbei is a language created by Zhanyong Wan following wenyan. Its source code reflects the characteristics of Northeastern Mandarin, a branch of Mandarin Chinese native to some 120 million people. It is implemented in, and mutual operatable with, Python.

Code samples

Hello World:

嘀咕:“Hello World”。         # literally: whisper "Hello World".

99 bottles of beer:

酒数从99到1一步-1蹿磨叽:        # lit. #wine roams -1 steps a stride from 99 to 1
  嘀咕:酒数、“ bottles of beer on the wall, ”、酒数、“ bottles of beer.”。
  嘀咕:“Take one down, pass it around, ”、酒数减一、“ bottles of beer on the wall.\n”。
磨叽完了。
嘀咕:“2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.”。

A more complex example:

无产阶级的接班银图形阶级咋整:	# lit. The class Figure, succession of Proletariat
# in dongbei, Proletariat is logically the common ancestor class
  面积咋整:			# lit. area gotta be
    整叉劈了:NotImplemented。
  整完了。
整完了。

图形阶级的接班银圆阶级咋整:    # lit. The class Circle, succession of Figure
  新对象(半径)咋整:          # lit. new object (radius) gotta be
    俺的半径装半径。            # lit. my radius = radius
  整完了。
  面积咋整:
    翠花,上math。		# import math, lit. Cuixua, math please!
    滚犊子吧math.pi乘俺的半径乘俺的半径!
  整完了。
整完了。

图形阶级的接班银矩形阶级咋整:		# class Rectangle
  新对象(长,宽)咋整:
    俺的长跟俺的宽抱团装长跟宽抱团。	# tuple assignment
  整完了。
  面积咋整:
    滚犊子吧俺的长乘俺的宽。
  整完了。
整完了。

那啥都是活雷锋。		# lit. all of That is living Lei Feng!
那啥来了个圆的新对象(3)。	# lit. in That came a new object of Circle (3)
那啥来了个矩形的新对象(3,5)。
老张在那啥磨叽:		# lit. Lao Zhang roams in That
  嘀咕:老张整面积。		# lit. whisper Lao Zhang gotta area
磨叽完了。

# Output:
# 28.274333882308138
# 15

Here is pseudo code(for that↑):

class Shape: 
{
    def area(void)
    {
        pass
    }
}
class Circle(super=Shape)
{
    new object int radius:
    {
        my.radius=radius
    }
    def area()
    {
        #import<math.lib>
        return math.pi * math.pow(my.radius, 2)
    }
}
class Rectangle(super=shape)
{
    new object int length, width:
    {
        tuple(my.length, my.width) = (length, width)
    }
    def area()
    {
        return my.length * my.width
    }
}

var circle1 = Circle(3)
var ractangle1 = Rectangle(3, 5)
@seg1 segment@
    print(Circle.area(radius))
    print(Rect.area(length, width))
@seg1 ends@

And Pseudo-LOLCODE-Script:

HAI 2.1
O HAI IM Figure        BTW 无产阶级的接班银图形阶级咋整:        BTW 目↓
    HOW IZ I getting_area
        BTW Passed
    IF U SAY SO
KTHX

O HAI IM Circle        BTW 目↑
    I HAS A radius ITZ NUMBAR BTW Do you dare to guarantee that there is no circle with a radius of √2? 
    ME'Z radius R radius
    HOW IZ I getting_area
        CAN HAS MATH?
        FOUND PRODUKT OF MATH'Z PI AN (PRODUKT OF ME'Z radius AN ME'Z radius)        BTW 滚犊子吧math.pi乘俺的半径乘俺的半径!
    IF U SAY SO
KTHX
OBTW
The decimal type is used because 
there is no guarantee that the 
length and width of the rectangle 
or the radius of the circle 
are exact integers.
TLDR
O HAI IM Rectangle        BTW 目↑
    I HAS A length ITZ NUMBAR
    I HAS A width ITZ NUMBAR
    (ME'Z length AN ME'Z width) R (length, width)
    HOW IZ I getting_area
        FOUND PRODUKT OF ME'Z length AN ME'Z width
    IF U SAY SO
KTHX

I HAS A rect_1 ITZ LIEK A Rectangle 
rect_1 R (3, 5)
I HAS A cir_1 ITZ LIEK A Circle
cir_1 R 3
VISIBLE (rect_1 IZ getting_area MKAY)
VISIBLE (cir_1 IZ getting_area MKAY)

BTW The grinding is over.

KTHXBYE

Computational class

Turing complete, because it can invoke any Python code.

整eval(“# Python code”)。    # lit. gotta eval ("# Python code").

See also