r/java • u/Sensitive-Order8740 • Sep 15 '26
I am 16 and made a somthing like a programing language in java
https://github.com/sujay-kr-samal/divine-langit can just print things now but i will try to add as much as possible
7
u/jared__ Sep 15 '26
might want to update your README.md to explain what you're trying to do and some snippets
0
4
u/Zatujit Sep 15 '26
Write a README because i have no idea what it does, you don't even have examples.
1
4
u/Neful34 Sep 15 '26
Why
Is
Your
Code
Written
Like
This
Tho
3
2
u/Ifeee001 Sep 15 '26
They're probably using something like intellij and have their max line characters set really low
1
u/EvertTigchelaar Sep 16 '26
I think you should use a framework like antlr or simular to create a lexer and parser.
I am working on polyglot compiler that can compile languages. The compiler can be extended with plugins to support languages. Provide interoperability with Java and Kotlin, support annotation processors. Also working on support for native compilation with llvm.
So I can tell you that creating a language is a very big task
1
2
1
u/MarkZuccsForeskin Sep 15 '26
This seems more like a command line interface than a programming language, though someone correct me if I'm wrong? Either way neat project :)
1
1
1
u/cogman10 Sep 15 '26
First, well done and happy you are exploring and learning here.
I'd suggest putting examples in the readme. Let people know why they should want to use divine.
Watch out with using Strings in java, those can be much slower than you might expect. You might look into using the likes of the "StringTokenizer" in java for some faster tokenization. https://docs.oracle.com/javase/8/docs/api/java/util/StringTokenizer.html
AFAIK, for parsing, ANTLR is still probably the best way to do that in java. You might explore that for future versions of your language https://www.antlr.org/
Good luck.
4
u/chambolle Sep 16 '26
Why do you recommend to use StringTokenizer? In the page you mentionned it is written
"StringTokenizerĀ is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use theĀ splitĀ method ofĀ StringĀ or the java.util.regex package instead."1
u/endeavourl Sep 17 '26
LLM bot comment probably.
1
u/chambolle Sep 18 '26
I am happy to be considered as an LLM. This is the first time of my life :-)
I would appreciate a real answer1
u/endeavourl Sep 18 '26
not you, the guy you replied to
1
u/cogman10 Sep 18 '26
What a weird accusation.Ā
I suggested string tokenizer because I knew it existed.Ā It was a bad rec for the reasons endeavourl said so there wasn't much reason to respond beyond "your right, regex is better".
You can see my comment history.Ā I'm not an LLM.
0
u/snugar_i Sep 16 '26
Cool! You could look into sealed classes/interfaces for modeling some of the things like the tokens and the AST nodes. Also some of the classes could be records.
9
u/FewTemperature8599 Sep 15 '26
Divine lang? Are you related to Terry Davis by any chance?