5 ms·
Jaithon 3, a fast programming language with the perfect syntax
- AbhiramaVS 2mo agoHi HN! I’m Abhirama, and I started Jaithon in 2023 when I was in 8th grade to teach myself how to code in C. Jaithon 1 was really bad, it was all in one file and it was completely an interpreter and it was extremely slow with bugs everywhere. Recently, I have came back to this project with the goal of making the perfect programming language that is not only fast, but it has the optimal syntax & features out of every programming language. Jaithon has Python features such as comprehensions, f-strings and first-class functions with declared fields, explicit visibility, traits and checked type annotations, along with syntax choices from lua, Java, bash, c++, go, and rust. The compiler separates lexing, parsing, type checking and bytecode generation. The VM has 107 opcodes along with a JIT compiler to speed stuff up, polymorphic inline caches and a garbage collector. Jaithon is nearly completely bootstrapped, with the lexer, parser, and bytecode generation built completely within Jaithon itself. The syntax of jaithon code is also easily customizable. You can build and run it with: git clone https://github.com/abhiramasonny/jaithon https://github.com/abhiramasonny/jaithon cd jaithon make ./jaithon examples/hello.jai It would mean a lot if you star the project on my GH as I am trying to reach 15 stars soon :) anyways, lmk if you have any feedback. Currently Jaithon is between Java and C++ for speed (a more detailed benchmark exists within the project by running make benchmark) and I am in the process of optimizing the VM. Would love to hear yalls thoughts! - Abhi (abhiramasonny.com)
- fcarraldo 2mo agoThis is extremely impressive for such a young entrepreneur. I have no reason whatsoever to use this, but it's a cool project!
- AbhiramaVS 2mo agoThank you so much!!
- tomcam 2mo agoCongratulations! What target environments does it support?
- AbhiramaVS 2mo agomacos is fully supported (gpu for apple silicon is written with obj C and coco, and the JIT is made for macos) and linux also works without GPU or GUI features. windows isnt supported lol though if you knew what you were doing it wouldnt be hard to port to windows (i personally dont have a windows machine to test/develop for)
- yyx 2mo agoI highly recommend you to rethink error handling. No way to know if function throws exceptions, no way to know what kind of exceptions. This is a minefield.
- AbhiramaVS 2mo agoI'm pretty sure I have exactly what you are talking about. error handeling was one of the things that I wanted to get right with jaithon, and I made my system similar to like rust. error[E0301]: cannot assign to immutable binding `x` --> examples/demo.jai:7:5 | 5 | let x = 1 | - `x` declared immutable here ... 7 | x = 2 | ^^^^^ assignment to immutable binding | help: change the declaration to `var x = 1` ^^ That was shown from the Readme, more extensive examples are in documentation! Is this what you were refering to or something else, I completely agree that erorr handeling is very important.
- mplanchard 2mo agoI think jyx was talking about the throw/try/catch mechanism[0] used for error handling, in contrast to error handling in e.g. Rust, where the idiomatic way of handling an error is to return a Result enum, containing either a success value or an error type. The latter allows callers to know that a function can error, and what kind of error it can return. Exception-based error handling, on the other hand, means you cannot tell by way of the type system whether or what errors a function can throw. [0]: https://github.com/abhiramasonny/jaithon/blob/main/LANGUAGE.md#errors https://github.com/abhiramasonny/jaithon/blob/main/LANGUAGE....
- AbhiramaVS 2mo agoAh yeah that makes more sense. Will look into this
- program_whiz 2mo agoAbhiramaVS I think your choice to use exceptions is fine, it matches closely with Java / Python your inspirations. The "show me every error" crowd loves to harp on this issue, but the truth is, its a tradeoff like all others. Exceptions provide flexibility in error handling, and most code just forwards and you end up in the same situation anyway. Something like this (go style): if result, err := do_thing(); err != nil { log.errorf("Got an error! %v", err); return err; } Or the rust equivalent isn't super useful, the code is just outputting an inferior form of stack tracing and debugging. Honestly unless the code at the immediate site of the error can handle the issue, or perhaps one level higher, having precise error information (usually obscured by some generic Error class anyway) isn't very helpful, and ends up propagating up to a high level where the whole thing is terminated / cleaned up anyway, which is what exceptions provide automatically. Also, only catching the things that you can deal with and know about is useful in the sense it keeps code flexible (e.g. you don't handle a DiskFull exception because the only thing you can do with it is throw anyway, and if you had a DiskFull error returned, you would just return it up the stack / panic). As new unhandled errors emerge, you just throw them up the stack, the same way error code would, except errors just require you to explicitly manage the machinery everywhere, requiring rigid, over-specified, fragile code in many cases. I do see the argument for explicit errors especially in system programming, realtime / perf-critical, kernels, etc. But this language doesn't appear to be targeted at that, and uses GC. So having exceptions seems like a valid design choice to me. Using them also frees you a bit since you can pass around functions, captured references, threads, etc. in a bytecode + GC lang without worrying to much about the error states and memory ownership.
- sieve 2mo agoNice! This is what I keep telling everyone: LLMs let you build stuff you may not have the time/energy to before. You still need to do the last 10% yourself though. Tying up all the loose ends. Syntax is a personal choice. Can always be changed. Architectural choices are difficult to manage later on. The VM seems to be a stack VM. I have my own python replacement project (https://news.ycombinator.com/item?id=48090665 https://news.ycombinator.com/item?id=48090665) that I am developing privately for now. LLM-assisted ofc. Started with a bytecode VM and then switched over to a register one. The biggest break from regular language systems was the decision to move to an Erlang-style preemptive scheduler.
- AbhiramaVS 2mo agoI completely agree! I started Jaithon before mainstream LLMs existed and for a while Jaithon was free of AI generated code and my personal stance on AI generated code was rather negative. Recently though, my stance has grown far more positive towards AI. While LLMs are undeniably the future it remains crucial that you completely understand the code being generated, and are also in control of the architecture in place. I have tried to adhere to both of these principals while coding :) and it is an unequivocal fact that AI made me atleast 10x more productive. Granted this is a bad measure but still a measure of such: in the last 2 days I have made the same number of commits as I have to Jaithon in the last 3 years. Also, I was curious why you swapped over to a register based VM, could you give more clarity on that and the benifits/negatives? currently im using some sort of bytecode vm, though its not like im married to the idea of a bytecode vm. Also (dont mean this as any sort of advertisement or anything like that) would you mind starring the repo? trying to hit 15 stars :D dont feel forced or anything like that.
- sieve 2mo agoThere are pros and cons to both approaches. I moved from stack to register because I was writing the code gen backend from scratch in any case and preferred to have a register representation instead of converting from stack to register (which has to happen one way or another). Also mildly helpful with control flow analysis during bytecode generation and verification phases.
- abhinai 2mo agoThis language keeps the best parts of Python while discarding the bad. I clicked the link apprehensively, but I have to agree that this syntax is spot-on (for me, at least). So many new languages miss the mark.
- AbhiramaVS 2mo agoThank you so much!! That was completley my intention and the reason why I was building it, and im really glad you liked it! To be quite frank, the syntax is more similar to rust compared to python in a couple of ways, but python is what inspired me to build the language. The syntax is just a combination of my personal preferences :) seems like we share a bunch in common!
- nullbio 2mo ago[flagged]
- skybrian 2mo agoFirst impression: looks more like JavaScript than Python?
- AbhiramaVS 2mo agoMore like rust than both of those tbh. When i first made jaithon i named it as such cus back then for one the syntax was vastly different and for two I only knew python and java lol. more recently I changed the syntax to be more similar to rust and js etc. Jaithon wasn't necessarily based on a particular language or multiple languages even per say, its just my preferences from all the languages ive coded in the past :)
- ch4s3 2mo agoI’m impressed that you got GitHub to accept the language/syntax! Gleam still hasn’t managed to convince them.
- xeetzer 2mo agoThat would have been cool, but he simply used the python highlighting: https://github.com/abhiramasonny/jaithon/blob/8f47ee5a52ffca273ca3369930b259b056008721/README.md?plain=1#L60 https://github.com/abhiramasonny/jaithon/blob/8f47ee5a52ffca...
- kmaitreys 2mo agoNo. The file uses same extension as Jonathan Blow's Jai which is actually a language GitHub supports.
- ModernMech 2mo agoNow that is crazy considering the language isn't publicly released and doesn't even have a release date; ostensibly, acceptance by Linguist includes evidence that the language is actually being used [1]. I didn't think an interminable private beta counted, seems a stretch of the word "actually". [1] https://github.com/orgs/community/discussions/196787#discussioncomment-17040102 https://github.com/orgs/community/discussions/196787#discuss...
- giraffe_lady 2mo agowdym they've had it for years? https://github.com/github-linguist/linguist/pull/5688 https://github.com/github-linguist/linguist/pull/5688
- timhh 2mo agoI'm still trying to convince them that RISC-V assembly exists...
- AbhiramaVS 2mo agoUnfortunately I did not do this :( I think a couple people pointed out but .jai already exists on github (I did not know about this when I first made it lol) and for the readme and stuff I did it via python for the syntax highlighitng lol. Maybe one day I can plead with the github gods to accommodate for jaithon :)
- andai 2mo agoNote: Unrelated to the Jai programming language (but they both use .jai file extension).
- PessimalDecimal 2mo agoAlso unrelated to Jython, aka the Python implementation on the JVM.
- IshKebab 2mo agoYes!! I love that you detailed AI usage in the readme. This should be 100% standard, even if you don't use AI at all, you need to say so these days. At the point where you add a license, add an AI usage section to your readme. This is a perfect example.
- AbhiramaVS 2mo agoYes! I agree. I wish github made this a standard or something like that, I personally just did the best I could with disclosure. Thanks for the kind words!
- mixmastamyk 2mo agoNeat, looks more like Rust than Java or Python on the surface though. That’s good in general. Also am slightly dismayed that new langs are copying the f-string, which was chosen only because Python had no more Ascii punctuation chars left for such a feature. Would much recommend shell-style quote syntax instead, perhaps omitting $.
- AbhiramaVS 2mo agoYes! Originally jaithon was made when i only knew python and java lol so thats why I chose the name. Recently I made major overhauls to the syntax in perferance to more rust coded sytnax [ cus i really like rust :) ]. Could you elaborate on shell-style syntax? personally I like fstrings and pythons convention, however im open to hear other reasons
- mixmastamyk 2mo agoOh, shell does interpolated strings with double quotes “age: {age}”, with $ but it is redundant. Single quotes are simple strings: ‘Hello world!’
- hallole 2mo ago> I would not consider myself a "vibecoder", or jaithon as "ai slop" > Additionally, around 80% of the raw code in this repository was produced with agentic coding tools Not to be a party pooper, but even if the author wouldn't themselves describe it as "slop," the term still applies. It isn't really a "collaboration" if the vast majority of the implementation was carried out by one (non-human) party.
- AbhiramaVS 2mo agoAI Slop is more of a convention than an actual definition. There is no standard definition (from what I know) that is widly accepted for the definition of AI slop: some people might say any use of AI is slop or others might have a more liberal opinion (like me) where if AI is properly used and generates good results, it is not considered slop. In my personal opinion (you are 100% free to disagree as this is just an opinion and not fact) the 'hard' part of programing is coming up with the proper architecture, and ensuring the codebase is maintainable and is able to be built on top of. Additionally, the word slop in my opinion signals that the product is terrible. In my opinion, the product of Jaithon is not terrible (like some AI generated code is) and as I have not only been highly transparent with the use of AI and also used it with an appropriate maner with limits, by my definitions of it, this is not considered slop. Additionally, the vast majority of the CODE was carried out by AI, not the implementation. Architecture & language automota were actually created in 2022-2023 while I was in 8th grade. AI was only used rather recently to speedrun development. Hope this serves as further clarification by what my readme and my words ment.
- andriy_koval 2mo agoslop likely means low quality. If author reviewed and directed every line of code, there is a chance result is high quality.
- AbhiramaVS 2mo agoyup!
- ModernMech 2mo agoIndividual authorship doesn't matter anymore, what matters is whether the user has control enough over the process to shape the output, and with recent AI agentic harnesses they do. > It isn't really a "collaboration" if the vast majority of the implementation was carried out by one (non-human) party. So then there is a ratio at which you would say it's a collaboration? What if I write the function signatures and allow the AI to fill in the implementations? What if I write half the implementation and the AI fills in the other half? What if I write comments and the AI fills in an implementation of the thing and then I review it and fix it manually, is that vibecoding or slopcoding? Are vibecoding and slopcoding the same? Moreover: does any of that even matter if the end result is functionally the same either way? I'm just trying to understand the acceptable way to use these tools because the opinions people have range from "not at all, never" to "all the time, always".
- vips7L 2mo agoSlop
- AbhiramaVS 2mo agofree to believe whatever you want.
- vips7L 1mo agoGenerated Sloppies bro
- threethirtytwo 2mo agoI know we need to stay positive for these show HN things because Dang said so. But how valuable are these when anyone can churn out one of these things with AI. I get how it's valuable to show off work, but it's also like looking at a play list of AI music. Good job tho! amazing prompting.
- AbhiramaVS 2mo agoI recomend you take a shot and try. Originally, I built Jaithon pre chatgpt (2022-2023) and in doing so I read a couple of books my dad owned about language automta and architecture. I stopped working on jaithon not because I couldnt code or anything, but more so because it took so long to actually push something that I would rather just work on a different project. idk maybe im just ADHD but thats just how it went for me. Anyways, back to your question, the architecture of jaithon is probably the most complex thing, and AI (atleast now) cant do this reliably. Syntax as well is something that is very abstract that AI isnt good at choosing. there is a lot more behind the scenes than simply oneshoting a prompt with opus and expecting it to work (spoiler it wont work well at all.) Would love to see you try to do this with pure AI
- threethirtytwo 2mo agoof course it's not a one shot prompt. But most people can do this with pure AI imo.
- sureglymop 2mo agoI'd say "most people" is wrong. "Most people on HN", yes, probably. Even though people that don't work in tech can now build a lot of stuff I think most wouldn't even know where to begin with stuff like this. Heck, I work in a web development/design agency with people who code in JS/TS all day and they still couldn't tell you the difference between interpreted and compiled code. Why? Because it's simply not relevant to their daily work.
- threethirtytwo 2mo ago
- chrisjj 2mo ago> still keeping a real human in the loop for the important decisions. How would the human ever know that, though?
- AbhiramaVS 2mo agowhat do you mean? I didnt understand your question
- chrisjj 2mo agoHow would the human ever know the so-called AI was keeping him/her in the loop for the important decisions?
- AbhiramaVS 2mo agoAgain I am a bit confused. Its not like the agent is driving the human, you are driving the agent. If your agent has to come back to you with periodic updates, then you are fundamentally not using it correctly. You should be actively monitoring the code produced by the agent, as frequently it is not doing stuff in an optimal way.
- deleted 2mo ago[deleted]
- teo_zero 2mo agoI can't help wondering why so many new languages provide two separate mechanisms to define mutable and immutable variables. I see a value in defaulting to immutable unless explicitly stated, like in Rust. But having to choose between two different 3-letter words, like let and var, what stops one from always using var? Coming to Jaithon in particular, I also wonder what the scope of immutability is, when it allows the following: let names:list[str]=[] names.push("whatever") If a function takes a list[str] as input, how do I signal that it does or does not modify the list? And if it does, will it only shuffle the elements (e.g. sort) or will it also change the strings themselves (e.g. uppercase all elements)? Const-ness is a complex topic, with more cases than can be captured by two keywords at variable definition.
- AbhiramaVS 2mo agoI can speak for Jaithon but this is standard across most languages who have like immutable and mutable variables. There is def nothing stopping you from using var everywhere, but (let) lets the compiler like catch any mistakes you did not mean to do. In jaithon, let is whats known as shallow: it prevents (in ur example) names = ... but the refrenced list is still mutable. Currently jaithon doesnt have anything like a read-only parameter so just knowing list[str] doesnt tell u anything about if a function mutates the list.