Share your repls and programming experiences

← Back to all posts
🔲 Mirror 🔳 - My Other Programming Language!
DynamicSquid

Hi!

I made another language. It's called Mirror.

It's statically typed and riddled with bugs. It's coded using Rust and transpiles down to C++.

I only had like 10 hours to make this so it isn't much. And this is also my first time coding in Rust so the code is really bad.

I'll probably revisit this sometime in the future though.

Check out its GitHub repo!


Here's Mirror's syntax.

Mirror has a built in print function that acts as standard output.

Variables are created using the set keyword. Their type is automagically deduced.

Conditionals are as expected.

Functions are defined using the def keyword.

Ranged based for loops are also supported.

And arrays.

And that's it!


Write code in the source.mir file. Here's some code to reverse your name. Try it out!

Enjoy :)

Voters
HENRYMARTIN4
maxina
zplusfour
figglediggle
LoganSpong
ninja2k11
KeironTravis
ethanshaozz1928
mkhoi
BotsBoots
Comments
hotnewtop
samfierycreeper

Lol for 10 hours still looks 500% nicer that JavaScript.

zplusfour
firefish

@ZDev1 haha palindrome go brrr

zplusfour

@firefish indeed

DynamicSquid

@firefish oh, how's the pkg manger going?

firefish

@DynamicSquid wut i'm too busy working on slicelang to do really anything (wanna join the project? we are currently working on a garbage transpiler. considering you've made one, do you consent to us (me) ransacking Mirror?)

firefish

@DynamicSquid I'll take that as permission to copy mirror for our trash transpiler.

DynamicSquid

@firefish what no

firefish

@DynamicSquid

wut i'm too busy working on slicelang to do really anything (wanna join the project? we are currently working on a garbage transpiler. considering you've made one, do you consent to us (me) ransacking Mirror?)

read the previous comment

DynamicSquid

@firefish I would, but I'm way to busy :( I barely have enough time to code Night

firefish

@DynamicSquid hm... sad :(
but if I erm... were to slightly change mirror's source to make slicelang transpile down?

DynamicSquid

@firefish sure, I'm fine with that. just don't copy everything lol

firefish

@DynamicSquid well we are only doing the bad transpiler to get the number of slice repos to 200 before the real thing comes out

zplusfour

um hi squid
can you tell me how can i go into language design and development?
thanks

edit: and plz answer me, shud i use Rust or C++?

DynamicSquid

@ZDev1 C++. Try to make a lexer first

zplusfour

@DynamicSquid yeah!
but can you tell where did you learnt?

DynamicSquid

@ZDev1 trial and error :)

zplusfour
firefish

@ZDev1 you learn from craftinginterpreters.com

LoganSpong

Me: creates test programming language with regex and stuff

You:
Me: WHAT THE HOW DOES HE MAKE THIS HOW JUST HOW THIS IS AMAZING

DynamicSquid

@LoganSpong lol thank you!!

LoganSpong

@DynamicSquid night tho

LoganSpong

also if you look up "night programming language" on google, your github repository is the first result! Congrats!

DynamicSquid

@LoganSpong ik! it's so cool!

LoganSpong

@DynamicSquid i want to make a pl but whenever i do, it always breaks down at the if, while and for statements. and operation parsing is impossible for me

DynamicSquid

@LoganSpong Try making a lexer

LoganSpong
xxpertHacker

How do you disambiguate between the condition and body of if statements?

Are brackets optional in if statements?
If not, you would have to change your example:

to

To keep it more consistent in its rules ^.

To remedy this, I suggest introducing an keyword that combines both, the if and the else keywords. I call it elif.

You could use it like so:

DynamicSquid

@xxpertHacker Yeah, I was definitely thinking of an elif to keep it simpler. But it separates condition from body by the curly braces.

DynamicSquid

@xxpertHacker Oh quick question, how do you initialize a shared_ptr with NULL? Does the default constructor initialize it will NULL?

xxpertHacker

@DynamicSquid Why would you want to initialize a shared_ptr with null? That sounds... counterintuitive?

xxpertHacker

@DynamicSquid Just tried it in a Repl, this works fine:

xxpertHacker

@DynamicSquid Sorry for the third ping to your question, but they're null by default.

Unless you need the literal C macro NULL, which is an integer, not a pointer.

code913

Are you just converting it to C++ then running it?

DynamicSquid

@code913 yup, that's what a transpiled lang is. But like Fuzzy said I kinda cheated since the syntax is so similar and there aren't a lot of differences, but i didnt have much time to do this

code913

@DynamicSquid ight imma head out gtg attend zoom online classes

code913

In conclusion,
squids can now develop programming languages

DynamicSquid
ThisUserTaken


squids takin over repl.it

ThisUserTaken

:O

elipie

teach me your sorcery now.

DynamicSquid
elipie

@DynamicSquid i need help again can you get on the PieC++Main repl or do you not have time...

firefish

@elipie craftinginterpreters.com, what sorcery

JBloves27

NICE! it seems like it has python syntax!

DynamicSquid

@JBYT27 thanks!

JBloves27
HarperframeInc

Another language!?

What's going to happen to Night?
Are you going to merge languages?

DynamicSquid

@HarperframeInc What no. I did this for a school project. Night is still actively developed

HarperframeInc
AmazingMech2418

Yay! Python but better!

DynamicSquid

@AmazingMech2418 yay thanks!

AmazingMech2418

@DynamicSquid You're welcome!

AmazingMech2418

@DynamicSquid By the way, in Python, type

Why Mirror is better. LOL!

DynamicSquid

@AmazingMech2418 lol! I never realized Python had that easter egg built it, that's pretty cool!

fuzzyastrocat

@DynamicSquid Python has 50 billion easter eggs hidden around... try import this or import antigravity.

DynamicSquid

@fuzzyastrocat I need some eastwr eggs. What about import squid it'll summon an ascii squid

fuzzyastrocat

@DynamicSquid Should be squod so that it's harder to find.

from __future__ import dynamic_whitespace => SyntaxError: Not a Chance

DynamicSquid
DynamicSquid

@fuzzyastrocat from future import dynamic_whitesquid

fuzzyastrocat

@DynamicSquid ImportError: Cannot find requisitioned squod in the current directory

Coder100

Nice! !eciN

DynamicSquid

@Coder100 thanks!

Coder100
Coder100

wait hold up why does your compiler use namespace std @DynamicSquid

Coder100

seems like a lot of unnecessary overhead @DynamicSquid

DynamicSquid
firefish

ew include! macro
if you want to try cargo maybe you can try an old enemy friend @Coder100's template known as RUST PACKAGES POG POG CRATE MOMENT or something like that. I'll make a flipping tutorial on the grammatical implications of pog, it's waiting to happen

Hope you know about the early return operator:

foo()? is short hand for

Hope that clears things up

realTronsi

@firefish

here you go spreading your eye rape syntax highlighting again
Coder100

LMAOOO @firefish

DynamicSquid

@firefish didn't have time to learn cargo, and yes, I know what the ? does

firefish

@DynamicSquid i can er teach you lol
it need no learning

DynamicSquid

@firefish it's fine lol. oh, how's mat1's pinger? is it keeping the cdn alive?

firefish

@DynamicSquid er better check

firefish

mirror gut

night better

DynamicSquid
Code1Tech

Syntax is like python, why did you choose it to be like that?

DynamicSquid

@Code1Tech Cause I only had 10 hours and I couldn't think of anything else :)

But it's nothing like Python. It's transpiled and statically typed

Code1Tech

K. Also, nice! For 10 hours, I'd say that is very good!
I could never write a language in 10 hours or under.
Correction: I would never be able to make a language (xD)
tl;dr, Good job!
@DynamicSquid

DynamicSquid

@Code1Tech Oh thank you!!

NoNameByProgram


electronics don't work underwater

DynamicSquid
RayhanADev

Ahhh I couldn’t wait for you to release this! Awesome language @DynamicSquid!

DynamicSquid

@RayhanADev wdym by "release this"?

RayhanADev

@DynamicSquid ‘when you made it public‘. You’ve talked about and I was waiting for you to post it!

DynamicSquid

@RayhanADev huh? when did I say that?

RayhanADev

@DynamicSquid mhh sometime within the last week. You mentioned Mirror (and I think gave the Github link I’m pretty sure).

DynamicSquid

@RayhanADev I'm not sure what I meant by that. But this language is public, anyone can use it...

RayhanADev

@DynamicSquid sigh. I mean you told me about it (a project you were working on) before you made the post xD.

DynamicSquid

@RayhanADev ahhhhhhhhhhhhhhhhhh I get it now lol xD

DynamicSquid

@RayhanADev sorry I'm slow sometimes

RayhanADev

@DynamicSquid (°▽°) yay finally. If you still didn’t I’d have to resort to more extreme methods.

RayhanADev
DynamicSquid
Codemonkey51

Python + cpp + js?

DynamicSquid

@Codemonkey51 + i don't really know what I'm doing

Codemonkey51

Lmao cool @DynamicSquid

Bookie0

Mirror mirror on the wall...

Who's the fairest of them all?

me

DynamicSquid

@Bookie0 lol nice!

Bookie0

yay thx :) @DynamicSquid

RayhanADev

@Bookie0

Insert Bookie0’s “fair” face

lmao, I’m sure you look fair xD.

Bookie0
RayhanADev

@Bookie0 (^_−)−☆

elburg

@Bookie0 that's a nice face

Bookie0

yay thxxx ;) @elburg

Wilke000

You @Bookie0... maybe... or maybe not, it depends on what mirror it is, the good one, or the bad one.
That is the good one

Bookie0
DungeonMaster00

oh cool rust

DynamicSquid

@DungeonMaster00 Yeah, it's a pretty cool language

DungeonMaster00

@DynamicSquid yeah im thinking about making one of my own.

it may or may not transpile to rust and bye

fuzzyastrocat

Nice! Though transpilation to C++ for this kind of language feels a bit cheaty :)

DynamicSquid

@fuzzyastrocat Yeah I thought that too. But I really wanted to practice making a transpiled language, but yeah I probably should of done it differently. I was thinking of making Mirror a functional language actually but I never got around to it for some reason

realTronsi

impressive for 10 hours

DynamicSquid

@realTronsi Thanks!

19wintersp

Reminds me of python with curly braces :)

DynamicSquid

@19wintersp Yeah lol. But it's statically typed and transpiled so that's different

19wintersp

@DynamicSquid Nice! Finally, Python's readability with type safety and without indentation!

DynamicSquid

@19wintersp Yup lol!