Share your Programming Language Jam submissions here!

← Back to all posts
Pebble
ktango (11)

Pebble

Pebble has been described (by one of us) as an arcane amalgamation of Python and JavaScript. We hope that's not true (but we'll buy ourselves commemorative mugs if it actually is).

Pebble is intended to be an intuitive, English-friendly, high-level language. Our goal was to balance simplicity with expressive power; to make a language that is easy to pick up the basics in, but which offers a surprisingly rich environment for the advanced user.

We actually created our own programming paradigm to run our language and have tailored our syntax to be consistent with it. Code-named the "call-binding paradigm", this paradigm is robust enough to mimic both object-oriented and functional programming paradigms, and the exact feel can be seasoned to taste by the programmer themselves. We find it cool because in it, classes are methods are objects are classes (check out the demo for details)… also types are first-class citizens.

We also re-imagine other features of what a language should be. We take a novel approach to designing a type system for which we're currently in the process of writing a compile-time checker; we rethink what a null construct should look like and we avoid that-scary-cool-doodad (you know, a monad) when we talk about it; and we reshape code into a more human, conversational flow.

But, enough of these high level, broad characterizations. If you're interested, take a look at the interactive demo. We encourage you to read everything because it nicely explains what's really happening.

Internals

Pretty much all code inside Pebble is built in-house. We wrote our own custom grammar-format, tokenizer, lexer, parser, interpreter, bytecode runtime, and demo-izer (not to be mistaken for the demonizer).

The code is all open source and can be found here

Demo

So there's an interactive demo that takes you through the quirks and peculiarities of Pebble. You can view it by running the embedded repl, though you may prefer to run it in a separate tab so you can resize the window and enjoy more real estate. Here is a link to the full repl.

Thanks

Pebble has been built by these lovely folks.

@whitemanthedj
@jillianzaff
@timothyjin
@zqianem

and me,

@ktango

We're new, don't know what we're doing, and having a blast.

Commentshotnewtop
MocaCDeveloper (511)

This is truly incredible!
How long did it take you guys to do this(and how many people worked on it??)
This is truly Truly amazing!

ktango (11)

@targetfanttthat so the idea for an intuitive, English like language came to me when I was trying to learn C++ lambda expressions while choking back tears. The project started about two months ago and we added a type system and formalized the call binding paradigm for the hackathon. We're a team of 5 but welcome anyone interested!

MocaCDeveloper (511)

@ktango I would be interested if I knew C++ lol but sadly I do not.
I wrote some C++ to help DynamicSquid setup his programming language but ever since I have not touched the language of C++.
But this is surely one unique language!

MocaCDeveloper (511)

@ktango I do have one question though!
What about C++ makes you want to use C++ to create a programming language?
For me, I use C because C offers a nice low-level feeling of things(dynamic memory allocations), and gives you full control and functionality of what goes on in the language.
So what does C++ offer that you like when creating a programming language, cause I would like to challenge myself and write my current programming language(in the process of being built) in C++

syc1 (24)

@targetfanttthat I would assume it's speed that motivated them to use C++. Considering they have to compile syntax into C++ then compile that code, it'd probably be better to use a faster language, and C++ fits that role perfectly.

ktango (11)

@targetfanttthat we use C++ because we're lazy... but we use it like C. Really the only C++ specific features we use are vectors, generics and cout. In fact, most of the critical path code is done in a way that is essentially already C code.

@whitemanthedj has actually suggested we change into C entirely, and I agree that eventually that's something we want to do. For the hackaton purposes, and for speed/ease, we decided to start with C++.

ktango (11)

@syc1 we're actually using our own bytecode runtime engine and compiling Pebble directly into that! But yes... we do like C++ for its general efficiency

ktango (11)

@targetfanttthat as some point we're going to be transitioning to C... and in the mean time, we'd love help with beta testing. Plus, if you have a feature you think would be a nice addition, we might even add it

MocaCDeveloper (511)

@ktango if you ever decide to convert it to C then I would like to be a part of the process!
(If you would allow me to)

MocaCDeveloper (511)

@ktango And by "using our own bytecode", do you mean you are simply compiling the project into binary so the user can then run pebble.exe?

ktango (11)

@targetfanttthat I'll definitely let you know when we start to convert the project to C. ALL help is appreciated!

ktango (11)

@targetfanttthat by that we mean that each program in Pebble "compiles" into a special binary format that's run on a virtual stack machine. Each instruction has a 1 byte instruction code and a 1 byte operand. If you're familiar with the JVM bytecode or the Python bytecode, its similar to those.

redsox2 (12)

This is definitely my favorite so far.

redsox2 (12)

@ktango I do not know how to download the make ultility for windows. Nor do I know how to do the g++ compiler. Can you be more descriptive of where to run which commands, and how to download what?

ktango (11)

@redsox2 so here's a good guide on how to compile a C++ project on windows. I'll also upload a prebuilt binary if you just want to use that as opposed to building the project yourself.

Link to guide

redsox2 (12)

@ktango Yeah, I am not as inclined with navigating the systems, so I think I will just use the prebuilt binary. But this is definitely my favorite jam entry. Good luck to you and your team mates.

syc1 (24)

I love this! The fact that the exists as a one-word comment is brilliant, and I really like the it and that keywords. Truly excellent work y'all have done :D

ktango (11)

@syc1 thanks! This was actually inspired by my habit of naming variables with "the" baked into the name... stuff like "theList".

syc1 (24)

@ktango Cool! Also, I'm having issues installing the lang, it won't make properly .-.

syc1 (24)

@ktango I'm getting an error when attempting to make, it's likely a bug of MinGW, but it says there's duplicate definitions of 'vsnprintf', then exits with code 1.

ktango (11)

@syc1 I just did a fresh clone/make and it worked for me? What error are you seeing? Also are you on windows

syc1 (24)

@ktango I am on windows, and the error is above

ktango (11)

@syc1 it might be easiest to use WSL... I'm not sure what you're problem is. I ran mingw32-make.exe and it built properly. This may be a problem with your setup specifically. What version of g++ are you using

syc1 (24)

@ktango I'm not sure, but can't you just send me the already made exe file?? Or is that not how it works?

ktango (11)

@syc1 at some point in these next few days, I'll build a WIN copy and upload it to github as as a "release". I'll ping you a link when I do... currently quite busy lol

ktango (11)

@syc1 Here's a link to where you can download a prebuild binary. Please note that we're low budget (rip) and haven't digitally signed it yet so you'll probably gets some Windows defender messages. You can ignore these.

Again, I highly recommend building the project yourself... it'll avoid these warnings altogether :)

whitemanthedj (1)

Something else that we were working on but didn't quite have to fully test were advanced "compiler" error messages, that alerted the user specifically what syntax error they had (and will eventually suggest ways on fixing it).

syc1 (24)

I still can't get this to work properly and I'm too lazy to try.

But I recorded this video showing my error.

syc1 (24)

I'm of course kidding, this post is a joke. It works fine now.

ktango (11)

@syc1 its 2020... but you did get me...

ktango (11)

For anyone (@redsox2 @syc1) who wants to build Pebble themselves on Windows, the best option is to use the Windows Subsystem for Linux (WSL). Some good documentation can be found here

redsox2 (12)

@ktango What is the file called 'pebble' contain. All I see are a bunch of question mark like characters as well as a few others. There are 58305 lines in the file, so you couldn't have written that either, so what is it?

ktango (11)

@redsox2 this is the binary file which results from compiling the entire Pebble codebase. It's essentially the machine code that runs the entire language. It's also OS dependent so I don't recommend copying it and running it on Windows as it's built for Linux and won't work. Here's a link to where you can download a prebuilt Windows binary to play around with. It hasn't been digitally signed with a cert so you can expect to see Windows throw a fit if you try and run it.

I highly recommend building it yourself, but the binary will work as well. Enjoy :)

P.S. Thanks for all the kind feedback

redsox2 (12)

@ktango Can you at least describe in more detail how to build it myself then? The VSCode thing didn’t make much sense. As I said, I am not a inclined at navigating the windows system. Can you please help? Besides the windows file says 32. Does that mean 32bit? Mine is 64, so it might not work.

redsox2 (12)

@ktango I'm pretty sure I can build it now. That article helped, however there is one thing I am still stumped on. What does the README file mean when it says "Clone the pebble repo"?

redsox2 (12)

@ktango Actually, I think that the same thing that happened to @syc1 happened to me.

redsox2 (12)

@ktango I am still very confused. I guess that means I am very amateur. I am just going to root for you guys to win so I can use your language on Repl.it. Else, I will wait for you guys to update your Github. Either way, you guys will be my favorite. Good luck!!

ktango (11)

@redsox2 thanks for the all the support! It really means a lot to all of use that our language is actually useful to REAL people. We're currently working on ways to make getting access to Pebble easier (because we want everyone to try it!). In the mean time, you could always fork the repo to get access to Pebble through replit.

redsox2 (12)

@ktango Yeah, I think I have done that. But it always has to go through the demo and stuff. How do I disable that?

ktango (11)

@redsox2 so in the root directory of the repl you should find a file called .replit. Open it up--its like two lines. The second line will read run = "rm ./pebble; make; ./pebble --demo".

Change this to run = "rm ./pebble; make; ./pebble" and you can skip right to running theprogram.pebl` file.

redsox2 (12)

@ktango I figured out how to use the prebuilt binary, I was being rather stupid before. I have been doing some C++ stuff and and learnt a bit, so now I can use the prebuilt one. However, I kind of want to prove to myself that I can build it. In VSCode, you have to have a C++ file open to build, you can't run a command to build it (at least I am pretty sure you can't). Do you know which file I should have open?