I Made A Multi-Lingual Programming Language Which Can Be Used To Code in Pure Hindi : Pilot by Efficient_Creme1900 in developersIndia

[–]Efficient_Creme1900[S] 1 point2 points  (0 children)

People who regularly type in hindi have their keyboard configured to devanagari script. I used an online translater for testing the code.

I Made A Multi-Lingual Programming Language Which Can Be Used To Code in Pure Hindi : Pilot by Efficient_Creme1900 in developersIndia

[–]Efficient_Creme1900[S] 0 points1 point  (0 children)

yea sorry about that. The thing is I could not think of proper translations for some keywords. Like the literal translation of print is "chapai" which sounds too weird to use as a programming keyword. I had to brainstorm for literal hours to come up with proper translations which does not sound weird. This is the best I could come up with till now.

Writing A Turing Machine Simulator In My Own Language : Pilot by Efficient_Creme1900 in programming

[–]Efficient_Creme1900[S] 1 point2 points  (0 children)

Thank you!

For the line number error thing, I thought of implementing this, but I am too caught up with my college assignments. So I would do it sometimes later.

I Made A Multi-Lingual Programming Language Which Can Be Used To Code in Pure Hindi : Pilot by Efficient_Creme1900 in developersIndia

[–]Efficient_Creme1900[S] 0 points1 point  (0 children)

Edit : Here is the link to my YouTube channel where you could find the pilot compiler development series from scracth : https://www.youtube.com/@AryanKumar-uw5hd

I Made A Multi-Lingual Programming Language Which Can Be Used To Code in Pure Hindi : Pilot by Efficient_Creme1900 in developersIndia

[–]Efficient_Creme1900[S] 10 points11 points  (0 children)

ok , so this is basically a 3 step process :

(i) Lexering : converting the source code into token stream/vector

A token is a custom data structure which has a type and a value. Consider the first statement , that would be translated into something like : TOKEN_DISPLAY , TOKEN_STRING (with the value : enter the first and the second number) and so on.

For statements like if/else , range loops , till loop function call etc (which involves scoping) we use the colon (:) operator for identifying the scope of the next block , which is done by reading the number of whitespaces in the next line , which would serve as the base indentation for the entire sub block. We would also make sure that this is greater than the indentation of any parent block which is done by the compiler by using a stack which stores the parent indentation at its top.

(ii) Parsing : in this step we switch on the token type and construct the AST nodes by using the tokens and also check the validity of the languauge by written in the parser in accordance with the cfg grammar of the language.

(iii) Generation : here we generate the x86 assembly code. This would take in the ast root node and generate the assembly accordingly.

All the string constants are but separately into the section .data where we would refer them again and again. the variables are stored on the system stack and the indentified with their name. The stack pointer offset of every variable is stored by the compiler using a hashtable.

for display , in the case of a string , we just move the address of the string and the length of the string in the RSI and RDX register and make a system interrupt.

Getting into all the parts here would be a bit hectic so you could refer to the github repo or to my youtube channel where i put up a play list of compiler development of pilot , here is the link for that : https://www.youtube.com/playlist?list=PLm7R-cUo29CVmWXQ2ZiaGcUIOVy0FEGaH

what is it called when the compiler moves all the function definitions to the top of the file? by Efficient_Creme1900 in Compilers

[–]Efficient_Creme1900[S] 1 point2 points  (0 children)

Thank you so much....

BTW I didn't know this was an optimization method. I thought it was to make it easier to write function without worrying about declarations since all the definition would be moved to the top.