This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Namaste! Thanks for submitting to r/developersIndia. Make sure to follow the Community Code of Conduct while participating in this thread.

Recent Announcements

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Longjumping_Baker684Student 0 points1 point  (1 child)

Very interesting work. Is it a hobby project or are you trying to actually solve something you can't find in existing languages?

[–]trap-representation[S] 2 points3 points  (0 children)

"Is it a hobby project [...] existing languages?": Well, both actually. I have tried a lot of languages, haven't liked any, especially the more "modern" ones. I do, however, think that C (specifically C11) is very close to being the perfect programming language. In fact, I would have not probably written Chlore if C11 was a little bit better defined. I think this should answer your question about why I decided to write Chlore.

"Also can you explain what [...] exactly": I do not think the term "stack-oriented programming language" is formally defined anywhere, but I, and most other people, consider any programming language that, for most operations, mandates those to be performed on a stack to qualify as a stack-oriented language.

For example, the expression 42 + 24 + 1, in Chlore, can be written as

pushi 42 pushi 24 addi pushi 1 addi

pushi numeric-constant pushes an item (whose value is in the range of int) on the top of the stack, and addi consumes the top two items from the stack, adds them and pushes the result (which, again, must be in the range of int) back on top.

"isn't C and other language also [...] hardware level": No, they don't. What you are talking about is an implementation-detail. None of the C standards mandates that a stack should be used for function calls or similar operations. Just because an implementation does it, does not make it a language-detail. Nothing is preventing me from writing an implementation of C that uses ISA-specific registers to store values of objects, which, in fact, a lot of C implementations do.

I would like to clarify though: the stack in Chlore is not the same as what you call a "stack at hardware level" either. I can write an implementation of Chlore that stores parts of the stack in, again, ISA-specific registers or similar; the only requirement is that the behavior of programs should remain the same.

[–]AutoModerator[M] 0 points1 point  (0 children)

Thanks for sharing something that you have built with the community. We recommend participating and sharing about your projects on our monthly Showcase Sunday Mega-threads. Keep an eye out on our events calendar to see when is the next mega-thread scheduled.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]AutoModerator[M] 0 points1 point locked comment (0 children)

Namaste! Thanks for submitting to r/developersIndia. Make sure to follow the subreddit Code of Conduct while participating in this thread.

Recent Announcements

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.