How To Make A True Coding Language: Part 1
h
CSharpIsGud (931)

Im making this tutorial series because almost every language i've seen posted to repl talk doesn't use parsing algorithms and I think it would be nice to see some that do. There are a couple flavors of these languages, typically they come in 2 forms
1) They use string splitting and regular expressions

Technically you can call this "parsing" or a language of some sort.
But you will very quickly discover you run into syntax limitations like having to have a separator for a lot of things.
Example:
set:var,Hello World;print:var

2) They do nothing at all but define some classes or variables

I don't know how people get away with this and then tell you to calm down when someone calmly separates what it is from what it isn't. Even when put in the best possible words as to not directly attack the repl itself.

Which is why I have decided to create a tutorial on making a programming language in hopes people start making ones that don't have the above flaws.

This tutorial is going to go bottom to top using no dependencies at all and will show creation of a lexer all the way up to the hand made recursive-descent parser!

The Lexer (or scanner, tokenizer, whatever you wish to call it)

Located in lexer.py

The other components will get their own files as they are created.

Next: https://repl.it/talk/learn/How-To-Make-A-Language-Parsing/39832

You are viewing a single comment. View All
BobNeo (39)

Can you like not hate on people’s projects just because they don’t fit your idea of a coding language?

CodeSalvageON (606)

@BobNeo they're modules at most, not "coding languages"

BobNeo (39)

That doesn’t excuse it. @CodeSalvageON

CodeSalvageON (606)

@BobNeo still, criticism is good and people should know what they're actually programming before they call it something else.

CSharpIsGud (931)

@BobNeo "my idea of a coding language" there is no my idea. its not a language if its just python with some defined classes, basically the same with .split and regexp

BobNeo (39)

That doesn’t excuse it either @CodeSalvageON

CSharpIsGud (931)

@BobNeo it does, because its true. but there isn't an excuse for blindly defending posts that don't even know what they are

LoganSpong (54)

@CSharpIsGud Also, I know who you're targeting.

CSharpIsGud (931)

@LoganSpong this applies to everyone who makes either of those types of not programming languages, your just the most recent

LoganSpong (54)

@CSharpIsGud Yours literally is Python. print(), Its just classes as well! And I can prove it! I can write any old Python code, and it will work!

LoganSpong (54)

@CSharpIsGud IsAlpha() is literally a redefinition of the str class and the function is .isalpha

Its also only 96 lines.
In Syntax.md IT LITERALLY SAYS: Some syntax borrowed from other languages.

Huh?

CSharpIsGud (931)

@LoganSpong good idea with isalpha, however by Standard syntax shared by most languages under expressions I obviously meant stuff like 1 + 2 * 3 which most languages share.

also its 97 lines because this is just the lexer and its in python.
if you look at my other langs like my python compiler you will see it quickly rises into the 3 digit range

LoganSpong (54)

@CSharpIsGud Python Compiler? Really? C'mon, triple-digits?
I can make one in 3-ish lines.

LoganSpong (54)

@CSharpIsGud Because you only have string analysing functions?

CSharpIsGud (931)

@LoganSpong I mean a real to native executable compiler, not a call to eval nested in a loop(which isn't a compiler anyway)

the one you make in 3 lines would just be using the existing python interpreter instead of making one

https://repl.it/@CSharpIsGud/CPython

[deleted]

@LoganSpong i will bet my life savings that you cannot make a python compiler in 3 lines

CSharpIsGud (931)

@LoganSpong Mine uses classes, but I never said the C++ classes were classes in my own language. If you look, you will see that the compiler doesn't actually support python classes because I haven't gotten to parsing those yet

And obviously I have to make a program for the compiler to compile

CodeSalvageON (606)

@LoganSpong he's not targeting anyone. If you call criticism "targeting" then "pls give upvotes"

LoganSpong (54)

@CSharpIsGud In python there is a compile function.

Python compiler:

code = input('Enter code here:')
exec(compile(code, code, 'exec')
NoelB33 (345)

@royaltgnail So when will you give your life savings to @LoganSpong

NoelB33 (345)

He’s obviously targeting somebody, this post came out right after he commented on the post he is targeting. @CodeSalvageON

CSharpIsGud (931)

@LoganSpong also thats just using an existing compiler and its compiling to bytecode(python is JIT compiled(TO BYTECODE NOT NATIVE) im sure so the compile function is basically the same amount of cheating as exec and eval)

BobNeo (39)

@CSharpIsGud I just got like 30 notifications from just this lol

JordanDixon1 (175)

@BobNeo @CSharpIsGud @CodeSalvageON Listen, heated discussions are not the reason repl.it was made. It was meant for making and sharing projects. It was meant for people that don't want to install the programming language on their computer that may be around 200mb! Also, I do believe CONSTRUCTIVE criticism is good, however, the keyword is constructive. You don't need to create a post about how someone else's post is invalid and wrong. You can simply comment on their post suggesting the name be changed to something different. @LoganSpong s module is actually really good, and although he may have the description wrong, it can still be really helpful for developers. I am working with him on making his module on pypi and I hope to see it on there soon. Anyway, I don't mean to point fingers, harass, or anything like that. I am simply trying to put an end to this heated discussion.

JaydenLiu1 (35)

@BobNeo ANOTHER NICE COMMENT! THE OTHERS ARE VERY RUDE!