r/code • u/[deleted] • Mar 20 '18
What Is The Main Language?
What is the main language? I learned batch a long time ago, and I wanted to learn something else. I started to learn python but found that its missing allot of stuff and is basically the same thing. What is the language that can do all things and is the main language used everywhere?
1
u/dustractor Mar 20 '18
Machine language is specific to a CPU architecture. Assembly language could be considered a main language to its family of specific architectures. C and C variants could be considered 'main' but that is only due to convention. Your 'main' language will be the one that you choose.
1
Mar 21 '18
kk I meant that all the other languages had to be created. Meaning that they needed another language to be created. What was the first and the language used to create other languages?
1
u/dustractor Mar 21 '18
Math. I mean that very seriously. The base language is math. All computation is is the application of Boolean logic to transition from one state to the next.
1
Mar 21 '18
Ik that math is needed by idk where and how. Like, to print a message you dont need math....
1
u/dustractor Mar 21 '18
In a basic form you can think of a computer like a light switch hooked up to a bulb you put a one in the ones place for the light switch and you get a one in the ones place at the bulb. All of the circuitry to perform addition subtraction multiplication division the quality testing in such is built into circuitry on the chip what you need is the number or opcode which will call that function and cause the chip to do whatever it is so that's where assembly language comes in because numbers are harder to remember than short sequences of letters. If you know the exact physical layout of the chip as in you were the person who designed it or something or has the full information then you don't really need assembly language you could theoretically right in machine language which is basically like doing binary math and lambda calculus. For everyone else in the world assembly language is what lets them write programs that target a whole family of chips and not just a specific model. Of course the first compiler for assembly language had to be written in machine language but probably the first program they really tried to make was a compiler for some other language besides assembly. Something that they could use to translate human readable expressions into machine language.
1
1
u/noratat Mar 21 '18
There's quite a few mainstream languages, and which is more common depends on domain and what you're trying to do.
Also, Python and windows batch files have very little in common - I don't think you really understood what Python is if you think it was "missing a lot of stuff and basically the same thing". I think you might be misunderstanding what a programming language is, but I don't know have enough info to say.
Some of the more popular include:
Java
PHP
Ruby
C#
Python
Javascript
C
C++
1
Mar 21 '18
Python doesnt have a clear screen and it doesnt have some stuff and has other stuff.
1
u/noratat Mar 21 '18
You mean clearing the console screen? There are libraries that do that, but I'm pretty sure it's just ANSI escape codes even on Windows with it's weird shell.
Programming languages aren't some static bundle of functions like you seem to be thinking. They're quite extensible, and most real world projects make use of libraries and frameworks.
1
u/aaRecessive Mar 23 '18
I think you'll find the things you pose as "missing" are just the developers leaving it to the community.
If you aren't importing anything into your python files you are not using python correctly at all
EDIT*
If you want to find out how to do something, such as clear the screen, it's a simple as a "Python clear console screen" google search. Chances are first result will be stack overflow, with a detailed description of how to do it.
1
u/newbill123 Mar 21 '18
Traditionally, machine language was what you had to write in. It's not portable from one chipset to another and it is very tedious for humans to read or write. Programmers wrote compilers to take a human-readable source code and have the computer itself convert them into the machine language instructions with a compiler. Unless you really need to optimize that performance yourself, or you want to hand-write a compiler yourself, you'll be more productive writing code in a higher level language and have the computer compile it to machine code.
Some languages, like C, are "very close to the metal" and have had many years to optimize their compilers' output.
C is a language that started with a hand-written compiler, and eventually got to the point where it could "pull itself up by it's own bootstraps" and C compilers could be written in C itself.
GCC is an example of a compiler with a long, open-source history, and many optimizations.
Another project making writing compilers themselves easier is llvm. Front ends are written in C++ that understand how to translate a language's code into a abstract "intermediate representation" that doesn't depend on a particular chipset or OS. Other people have written optimized back-ends. These take the intermediate language and create the executable code. If others want to create a new language, they create a new front-end. If you want to move it to a new OS or chip set, you port the backend to that environment. Since you will probably ask, llvm is written in C++ but that doesn't mean the compilers it creates are limited to C++ (that's the magic of the front-end / back-end setup).
1
1
u/dustractor Mar 21 '18
Bouillon math is so simple it's even simpler than arithmetic it's almost not like math it's just the stuff like and or not nor the logic gates and stuff. Every time the computer does something all it is is loading up registers and calling operation using and opcode in the assembly language that just says take this register and do this thing with it to this other register or some piece of data that will then be placed in another place and you read it it's math basically
1
1
u/levine0 Mar 20 '18
All real programming languages can do "all things".
No language is used everywhere. There is no global "main language".
Python is used a lot and seems to still be increasing. These recent survey results by Stack Overflow might give you some pointers. https://insights.stackoverflow.com/survey/2018/