Share your repls and programming experiences

← Back to all posts
ParseLang: The language that expresses itself
Charrey

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:

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

(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.

Voters
sharonrema
ThroneUnknown
Leroy01010
Viper2211
zclarke
boschma
EthanHorowitz
MarcusWeinberger
minchingtonak
furesoft
Comments
hotnewtop
HansvdLaan

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

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

[deleted]

Somehow this reminds me of comby

Charrey

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

RickiTomphson

@Charrey I understand how difficult it was for you to write this study. Every day a person overcomes himself in something (you can find out about this here - https://samploon.com/free-essays/overcoming-obstacles/) and develops due to this. Of course, in the 21st century, it is foolish to stand still and not go forward.

TheDrone7

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

Charrey

@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

@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

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

TheDrone7

@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.

HahaYes
DynamicSquid
HahaYes

@DynamicSquid ah ok. You working on your memorization thing?

DynamicSquid

@HahaYes yeah I just posted it

DynamicSquid
HahaYes

@DynamicSquid ah ok, I"ll go upvote it

DynamicSquid

@HahaYes I'll pretend I did not see that

HahaYes
DynamicSquid

@HahaYes but you learned something right? say yes

HahaYes
HahaYes

@DynamicSquid also mech is like afk.

DynamicSquid
HahaYes

@DynamicSquid wait is memoization supposed to be like that?

Charrey

@DynamicSquid Memoization is the core of packrat parsers such as ParseLang's. Nice tutorial :)

DynamicSquid

@Charrey oh thanks!!