Share your repls and programming experiences

← Back to all posts
The L Programming Language
theangryepicbanana (1524)

The L Programming Language

This is a programming language that I made as my final project for my CS class this past year (for those of you who are curious, I got a 98% on it). It ended up turning out much better than I had expected, so I thought it'd be cool to share it here on Repl Talk.

What is L?

L is an array-oriented programming language made for performing complex operations on large sets of data. It is inspired by languages of the same category such as R, Julia, and J (which was my main inspiration).

While it appears to be an abstract mess of symbols at first, the conciseness of using symbolic operators as opposed to named functions allows you to do more by doing less.

About J

J was my main inspiration for L. I had found J a few months ago after doing some stuff for the APL language mode here on repl.it, mainly because J is highly influenced by APL (minus its Unicode character set).

The core concept in both languages is that you can create new functions by composing existing functions, all of which can either be a unary operator (monadic; takes one value) or a binary operator (dyadic; takes 2 values). While L does not allow you to compose functions (that would have taken way more work and I didn’t have time for that anyways), it does have the monadic and dyad operator features.

Another core concept is that when you perform operations on an array of values, the operation is performed on each value of the array. For example, doing 1 2 3 + 1 will give you 2 3 4 as a result. If you perform a binary operation on 2 arrays of the same length, it will perform the operation on each element of the arrays in parallel. For example, doing 1 2 3 + 4 5 6 will give you 5 7 9.

If I had more time…

If I had more time to work on this, I would have added things like:

  • More mathematical operators (log, trig, etc).
  • More statistical operators (min, max, average, etc).
  • More operators in general.
  • “Boxed” sets (that don’t perform operations on every value it has).
  • “Flat” sets (opposite of above but one level deeper (if that makes sense)).
  • User-defined functions/operators.
  • “Lazy” expressions that can be assigned to variables and aren’t evaluated until they’re referenced/used.
  • Better documentation.

Documentation

Because the original documentation for my project is super long (too long for a Repl Talk post), I've included it in the repl files as a PDF (file name is Docs.pdf).

Examples

Factorial

num: 5
{* (1..num)

Filter numbers between (min, max]

range: 1..10
min: 2
max: 8
range ?> min ?<= max

Prime number checker

num: 17
#(num / (2..num-1) % 1 ?= 0) = 0

Future thoughts

Might try adding more features to this in the future like user-defined functions or something. Also might try rewriting this in Rust since it'd have less boilerplate than doing it like this in C++

Commentshotnewtop
wulv (46)


Mind blown

But anyway, really cool language! If it had all those missing features I might consider actually using it

DynamicSquid (878)

You had to create your own programming language for CS class? Damn...

Wait, does your CS class teach C++?

theangryepicbanana (1524)

@DynamicSquid I choose to make a programming language (because we weren't allowed to make a game), but yeah the class is C++

DynamicSquid (878)

@theangryepicbanana Oh cool! And was this the best project in the class?

theangryepicbanana (1524)

@DynamicSquid Not sure (because the teacher didn't announce anything like that), but it was most likely one of the best

Jakman (168)

You C++ chads are always out with some cool stuff. Nice.

studentAlfredAl (330)

It seems like everyone is making their own coding language now 😂
Anyways, good job! Keep it up :)

FunnyLamma (80)

Sense your a moderator, I have a question for you.

FunnyLamma (80)

Can you report someone for copying someone elses code and then posting it saying they coded it?

theangryepicbanana (1524)

@FunnyLamma Yes you can (and you always should!)

theangryepicbanana (1524)

@FunnyLamma It's been taken care of. Thanks!

ChezCoder (1172)

@theangryepicbanana hi, i have been longing to talk to a mod ever since I got a moderator warn for something I didn't do :(. So basically, this guy created a bunch of posts on multiple boards with a very inappropriate title and very inappropriate content. I mentioned a moderator to get it removed fast because the report function took forever. I actually mentioned the moderators on all the posts this guy made. But the thing is, the notifications made it look like I made the post and since I mentioned them on posts with the same name, it looked like I was spamming them. Then, because it looked like the post was mine, it looked like I was swearing. And guess what happened? I got warned for swearing and spamming. :/

theangryepicbanana (1524)

@ChezCoder Thanks for bringing this to my attention. Have you communicated with the moderators on the Repl.it Discord server about this yet? I wasn't aware of this when it happened, so I can't really determine what did/didn't happen, but the other moderators on the server will probably be more helpful than I can be right now.

FunnyLamma (80)

@ChezCoder,I had something similar happen to me on another website, it was awful.

ChezCoder (1172)

@theangryepicbanana yes, I direct messaged Vandesm (im scared of pinging mods now xD) and he said that he had no power to lift the warning and I tried creating a ticket with them but I got no response :(

theangryepicbanana (1524)

@ChezCoder Message the "Hoot Boot" bot if you'd like to contact the mods privately then :)

ChezCoder (1172)

@theangryepicbanana like 2-3 days ago. They never replied since :(

theangryepicbanana (1524)

@ChezCoder Hmm that's odd. Try doing it again, and I'll make sure that someone replies to it

ChezCoder (1172)

@theangryepicbanana also very good language! I might use it to do the next #weekly xD

theangryepicbanana (1524)

@ChezCoder No problem, and I'm glad you like my language :)

roylatgnail (844)

@CSharpIsGud
look, an actual quality post

sugarfi (462)

@roylatgnail yeah, doesn't happen often

sugarfi (462)

@roylatgnail and look, 5 upvotes
vs. 54 for a bunch of functions and classes

StudentFires (280)

@sugarfi When you post an entire language, to get 10 cycles, then someone else posts that we need to stop praising cycles and gets over 50.

sugarfi (462)

@StudentFires I got that post locked so I can't get cycles from it.

DarshanRajpara1 (7)

I've been wanting to make a programming language for a long time now, but could never seem to be able to find any good tutorials. Can you teach me?

Programmer567 (15)

[Mostly] Everyone is making a working programming language XD!
Oh, you know what? Next thing you know L is going to be a programming language on repl! Oh, just imagine that though LOL!

rediar (258)

Cool, but what kind of name is L?

theangryepicbanana (1524)

@rediar J and K are existing languages that helped to inspire L and L comes after J and K in the alphabet

MesyetiIsTaken (53)

Cool, but what kind of name is [email protected]

rediar (258)

@MesyetiIsTaken a bad one. Must be a minor language. Never heard of c or cpp or CSharp or anything, so obviously bad language.

MesyetiIsTaken (53)

idk if this is a joke ._. but it isn't the best to judge a language by whether you know it or not @rediar

rediar (258)

@MesyetiIsTaken no the best way is to judge by name.

theangryepicbanana (1524)

@rediar You should never judge a language by its name, as that's no different from judging a book by its cover

rupinYAY (9)

Yesterday night I realised that Crystal was already a language :( So I am going to create a language called Synth! And what I thought for it is that every line ends with this +. But @theangryepicbanana can you please help me because i seems you know how to do it thanks.

theangryepicbanana (1524)

@rupinYAY While I am experienced in implementing languages, I cannot go through the design process of your language for you. I also have my own languages that I'd like to work on, so I'd recommend you look at some online tutorials for making languages like craftinginterpreters or MAL if you want some more resources on how to make a language :)

rupinYAY (9)

@theangryepicbanana I checked youtube videos bu they dont go that in depth about this stuff.

theangryepicbanana (1524)

@rupinYAY These aren't youtube videos though; they're in-depth tutorials that show you how to make a complete programming language. I'd recommend checking them out

rupinYAY (9)

@theangryepicbanana I know maybe I will talk to someone I know.

PDanielY (959)

Is there any reason it is called L?

theangryepicbanana (1524)

@PDanielY Yep! J and K are existing languages that are similar the language, so I chose L because it comes after K

rupinYAY (9)

Dude you go to tell me how to make my own language. I can not figure out how to do it. My language that I am making up it is called Crystal!

CodingCactus (2095)

@rupinYAY wow, you made a language that got onto repl.it, well done

theangryepicbanana (1524)

@rupinYAY I'm hoping to making a custom language tutorial soon :)

CodingCactus (2095)

That already existed :P

ik, i was trying to be sarcastic, but it don't work on comments : (

Mohammad96 (21)

WOW!
How can you make a programming language?

theangryepicbanana (1524)

@Mohammad96 Reading and going through tutorials like craftinginterpreters and MAL have helped teach me the basics of making a language :)

Crcoli7307 (13)

I would die trying to write 337 lines of code. I barely can do 200.

Here lie Crcoli7307. Cause of death: Writing too much code.

I can't imagine what the poor kids at Microsoft had do go trough, writing 50 million lines of code.

MesyetiIsTaken (53)

we need a memorial day for coders like [email protected]

StudentFires (280)

After thoroughly looking at this, I barely remembered that C++ switch cases only allow numbers. That sucks.

theangryepicbanana (1524)

@StudentFires they do allow enums and characters though (and strings if you enable an extension I think)

StudentFires (280)

@theangryepicbanana Well, enums only allow integers, and chars are integers. But I was looking at why you hadn't used a switch case instead, then it hit me, you can only use ints.

StudentFires (280)

Might I suggest using C++'s <valarray> to have done the same thing and save you some time?

theangryepicbanana (1524)

@StudentFires <valarray> wasn't taught in the book that the curriculum used, so I couldn't use it :/

StudentFires (280)

@theangryepicbanana What? It wasn't taught so you couldn't use it? That's extremely unfortunate. If my teachers were like that, I don't know what I would've done.

theangryepicbanana (1524)

@StudentFires yeah ikr.
? I couldn't use all of the helpful stuff like <any>, <optional>, <functional>, lambdas, or namespaces because they weren't in the book. Thankfully snart pointers were though :)

StudentFires (280)

@theangryepicbanana I use lambdas, namespaces, and std::functions quite often. Btw, using G++ with std=c++17, allows you to do stuff like auto f(auto x, auto y). Were you allowed to use templates? What compiler could you use?

Though, might I ask, why did you use .h files instead of .hpp?

theangryepicbanana (1524)

@StudentFires Re: templates, yes we could use them, but we could only use type templates (so we couldn't use literals or constraints in the template parameters). Re: compiler, we were forced to use VS2019 for everything in the course. Re: .h/.hpp, VS didn't seem to have an option to use .hpp for headers

StudentFires (280)

@theangryepicbanana I've never used VS2019, I doubt it supports 2020 C++ though. Was this a college class or what?

theangryepicbanana (1524)

@StudentFires it's just a college class for highschool

StudentFires (280)

@theangryepicbanana I forgot you said it was an AP class.

theangryepicbanana (1524)

Oh yea I also had to implement like a crude GC thingy for this because C++ is bad