DEV Community

Cover image for I Designed a Language Which Let's You Program in Cats' Language
Palash Bauri 👻
Palash Bauri 👻

Posted on • Updated on

I Designed a Language Which Let's You Program in Cats' Language

Computer Programming can be hard , can be complex to understand for some people, but that doesn’t mean that they can’t be fun. From the beginning , programming languages were in English , well most of them except some special languages. But I have designed a programming language which let’s people program in Cats’ language, Mew Mew Mew. Which despite being a esoteric language is very much usable , and let’s programmers create complex program.

🎉 Say Hello to MewMew

Programming in Cats’ language , it is lunacy or what? But it’s reality. With MewMew one can program in cats’ language, but it is not actually the cats’ language but the human interpretation of cats’ language , mew mew mew.

MewMew is an esoteric programming language built with ANTLR4 and C++. It is not intended to be used for commercial or mainstream programming instead , it was designed to be learning project for me. While majority of programming languages are in English or I should say human languages but this language intends to be one of the first language to be in ‘non-human’ (not technically) language.

MewMew is implemented using ANTLR4 and C++. Though using Dynamically typed host language would be given me more flexibilty designing the language, I chose to use a statically typed for a multiple reasons , First it is fast. Second , the language becomes much more runtime safe. When experimenting with early prototypes , I tried Python and PLY (Python Lex and Yacc) , Tatsu and even Flex & Bison. Python and PLY was not chosen because it was too much slow , even Cythonzing didn’t give advantage. Tatsu was kind of better than PLY but again speed issue, and Flex & Bison , I didn’t chose them because of their over complexity , a language small as MewMew required a huge codebase. Finally I setteled for ANTLR4 , It was comparativaly fast thanks to its ALL(*) algorithm , on top of that the API of it was very easy to catch on but also very robust.

When Designing MewMew , I left some places which can be used to improve or extend the language in future.

MewMew doesn’t use any traditional numbers (0 to 9) instead it uses ‘mew’s. For example , mew will get converted to 1 , mewme will get converted to 2 , mewmewmewmewmewmewmewmewmewmew will get converted to 10 and so on so forth but zero has special case , to get only zero one can use ‘mew-mew’.

MewMew also has few operator similar to C++, which are discussed in GitHub project repository README. MewMew is all about numbers, it doesn’t contain any other types such as strings , chars , arrays etc , which keeps the language lightweight. Every number in mewmew is a floating point number.

MewMew also has if , if else and a repeat loop aka. Meow loop expression. It also has a special type of function called scratch function which open the door of extending the language in future. Syntax of if statement is something like Expression ? Statements ; where Expression takes any type of expression , on Truthy value the ‘Statements’ will get executed. Similar to that Expression ? Statements1 : Statements2 ; is the syntax of if-else statement, if the value of Expression is truthy the Statements1 will get executed else Statement2 will get executed. The syntax of meow loop is something like this @ Expression : Statements; the Statements will get executed N times where N = Expression. Scratch function syntax is something like #(Expression) where ‘#’ can be repeated from 1 to many times. But as of 5 functions are defined only.

Here’s a comparison of some simple program written in MewMew and C++ :

In MewMew In C++
m=mew;
@#####(mew):
m % mewmew == mew – mew ?
::m;
;
m = m + mew;
;
#include
using namespace std;

int main()
{
for(int m = 1; m <= 100 ; ++m){
if (m%2 == 0){
cout << m << endl;
}
}
}
m=mew;
@####(mew):
m % mewmewmew == mew – mew & m % ###(mew) == mew – mew ?
::m;
;
m = m + mew;
;
#include
using namespace std;

int main()
{
for(int m = 1; m <= 100 ; ++m){
if (m%3 == 0 && m%5==0){
cout << m << endl;
}
}
}

CONCLUSION & FUTURE WORK

MewMew is an esoteric language which is more like a joke than a commercial language. It was created to be a leaning project for which it has done successfully. In future it also might work as an reference to learning language designing for future.

With the scratch function it opens new doors for expanding the language in future. It will only took a few lines of code in switch...case statement to add a new function.

GITHUB & DOCUMENTATION

GitHub logo bauripalash / mewmew

/ᐠ。ꞈ。ᐟ\ MewMew Programming Language - Program in Cats' Language

/ᐠ。ꞈ。ᐟ\ MewMew Programming Language

MewMew is dead. Checkout Mewl, program in cats' language

. . C/C++ CI Version 0.2b

Give a Star 🌟 to this project to support this project

/ᐠ。ꞈ。ᐟ\ MewMew 🐱 is an Esoteric Just for Fun programming language. You can program in cats' language with MewMew. Have Fun!

🎉 Get Started

😸 Integers

There's no concept of numbers (eg. 1 2 3 4 100) in MewMew, instead we use mews. 1 mew is equal to 1 , therefor mewmew = 2 , mewmewmew = 3 , mewmewmewmewmewmewmewmewmewmew = 10 and mew-mew = 0. (You got the Idea, right)

😸 Operators

MewMew supports a few types of operators =>

  • + -> Addition
  • - -> Subtraction
  • * -> Multiplication
  • / -> Division
  • ** -> Power
  • ~ -> Absolute Value
  • - -> Unary Minus
  • > -> Greater than
  • >= -> Greater than equal to
  • < -> Less than
  • <= -> Less than equal to
  • == -> Is Equal…

Top comments (2)

Collapse
 
fardeen9983 profile image
Fardeen Khan • Edited

I love this Mew * 3000

Collapse
 
bauripalash profile image
Palash Bauri 👻

Actually there's no concept of traditional numbers in MewMew. But still glad you liked it.