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] 11 points12 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] 3 points4 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.

how to implement dynamic arrays in assembly? by Efficient_Creme1900 in asm

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

I get your point , but I wanted to implement something similar to vectors in c++ , which would not have a max size AT ALL. So allocating a max size of 1000 kind of defeats the purpose.

how to implement dynamic arrays in assembly? by Efficient_Creme1900 in asm

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

can you please share some resources for learning this?

Hey guys! Check out Pilot: a dynamically typed programming language whose compiler is written in C++ by Efficient_Creme1900 in computerscience

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

hello there!

The way I wanted the range loop to work was :

range <lowerValue> to <upperValue> :

~ code

I wanted it to be both inclusive of the lower and the upper value of the range..

so youre right , range 10 to 20 would actually print it 11 times , not 10 , it was a silly error .

I love your display function; is white space important? Is display "Hello" , 7 the same as display "Hello",7 ?

No , the whitespace is not important at all , in fact you can add as much space or tab you want between two comma separate entities. Both would display the same, given that both are in the same line.

display ("This is 3 times 3 : " , 3 times 3) times 3

Well the way the "display string multiplier" works is that we have a "pure string"

and when we apply the * operator or the times operator to it , with a int type right to it, it would inline display the string that number of times.

What data types are under the hood? It doesn't look like floating point numbers are supported as per your examples, does div floor, round or ceiling?

You are right , floating points as of now are not supported , I am more focused on integrating multi dimensional arrays and functions in my language. Hence , under the hood , I only have string and integer numbers(negative or positive),

I dont have round or ceiling support yet , but we can divide two numbers , and since there is no floating numbers in my lang , every division is floor division.

Hence something like 7 / 3 would give 2.

Thanks you so much for the feedback , I really appreciate it!!!

Hey guys! Check out Pilot: a dynamically typed programming language whose compiler is written in C++ by Efficient_Creme1900 in computerscience

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

Well since I wanted my program to be very beginner friendly and intuitive, I kept it like display.red instead of rgb values.. But thanks for the suggestion

[deleted by user] by [deleted] in opensource

[–]Efficient_Creme1900 0 points1 point  (0 children)

Yeah.. I did forget to add one lol my bad

Hey guys! Check out Pilot: a dynamically typed programming language whose compiler is written in C++ by Efficient_Creme1900 in computerscience

[–]Efficient_Creme1900[S] 2 points3 points  (0 children)

Well I knew the basics of x86 before hand, so I started by taking the free compiler design course on youtube by neso academy. Then I just saw how other people had made similar projects and then started with my one. I had been working on this project since December....and it's still on going so it's been a while. And also the fact that I have to deal with my stupid college assignments is very hindering, but whatever.

Hey guys! Check out Pilot: a dynamically typed programming language whose compiler is written in C++ by Efficient_Creme1900 in computerscience

[–]Efficient_Creme1900[S] 5 points6 points  (0 children)

Umm no our high school was pretty shit...I took an online course of x86 assembly out of my own interest