Share your repls and programming experiences

← Back to all posts
ParseLang: The language that expresses itself
h
Charrey (20)

ParseLang

The language that expresses itself

(Use the PDF readme for a table of contents and better layout)

Team: @ParseLang
Members: {@Charrey}
Repl: https://repl.it/@ParseLang/ParseLang

Programmers love languages. They love to use them, have both interesting and fruitless discussions about them, and above all, they love to design them. All that love comes at a cost, however. This is why there are about 24 Javascript frameworks and about 9000 programming languages, most of which you've never heard of. Many of these languages originate from people who want to develop in a specific style that their preferred language does not support (e.g. lambdas), or who want to express their world view in their code.

Take for example the simple System.out.println("Hello world!");. Some developer like to type it that way, while some people prefer printf("Hello, World!");, print("Hello, World!") or even Dear compiler, would you be so kind as to print the string "Hello, world!" for me in the console?. In pretty much all cases, the programming language that you use decides which of these you have to use to get that famous greeting printed in your console.

Not with ParseLang.

Some languages are more flexible than others: some allow different ways to express the same semantics, some have weak typing and some don't even care whether you use semicolons. ParseLang is so flexible, it allows all of this and much more. In fact, it allows you to change the grammar of the language itself while it is parsing. In it, you program by extending the language with new parse rules and also using the language to describe the semantics of that new rule. This way, it allows any semantics to be coupled with any textual expression.

While it allows you to extend the language to a beautiful, simple whole, it also allows you to go completely overboard. Take the following two examples of beauty and madness that demonstrate what ParseLang supports after extending the language yourself:

(after some lines of code to allow the following syntax...)

44| FooExp < SimpleExpression = 'excited ' NumberLiteral b {
45|     String result = 'hello';
46|     for (int i = 0; i < b; i = i + 1) {
47|         result = result + '!';
48|     };
49|     result;
50| }
51| 
52| excited 20

> hello!!!!!!!!!!!!!!!!!!!!

(Want to try this? Try calling runDemo("examples/forloop.plang"); from Main.java, then clicking Run.)

Evil < Number = '9' {
    8
}

1997

> 1887

(Yes, we are literally redefining the literal 9 as having the semantics of the number 8. Try changing it to a two-digit number for funzies! Try calling runDemo("examples/madness.plang"); from Main.java, then clicking Run.)

Don't be scared of the complexity of this example: you can make the language precisely as complex as you want because you are the one extending the language (beyond its very basic set of instructions). As you can see, you can go completely overboard with how you want to specify your semantics, and ParseLang will run it.

Commentshotnewtop
HansvdLaan (4)

This looks like an awesome language for DSL development! Just take the stuff you want from the base language and add the domain concepts /syntax on top.

Charrey (20)

@HansvdLaan Thanks! That's certainly a great use case :)

drsensor (15)

Somehow this reminds me of comby

Charrey (20)

@drsensor Looks interesting! I'll be certain to look up some of the parsing techniques that they use :)

TheDrone7 (1326)

Moving to share since 1 member team are not allowed as specified in the blog post

Charrey (20)

@TheDrone7 I suppose you can't just judge it as a two-person project in which the second person was idle? I saw people looking for teammates for exactly that strategy. Furthermore, shouldn't it be considered a feat to deliver the same result with half the manpower?

I see now that this is one of the rules, but I was genuinely unaware of this during the jam.

TheDrone7 (1326)

@Charrey As for you first statement, I have not come across even one such submission thus far. And just imagine how better it could've been if you had twice the manpower. Many people can write a programming language by themselves in 1 month of time, but that's not what we were looking for.
I'm afraid, I'm going to have to disqualify you for not meeting the requirements.

Charrey (20)

@TheDrone7 I'm sorry to hear you feel my project is of such poor quality, but I respect you sticking to the rules.

TheDrone7 (1326)

@Charrey don't get me wrong. I never said it is of poor quality. I only provided a counterargument as in if it's this good right now, imagine how good it could've been if that condition was satisfied.