Javascript Is Very Very Powerful, It's Not Just Script. - Programming (3) - Nairaland
Nairaland Forum › Science/Technology › Programming › Javascript Is Very Very Powerful, It's Not Just Script. (5274 Views)
| Re: Javascript Is Very Very Powerful, It's Not Just Script. by micodon(m): 2:57pm On Aug 16, 2015 |
dhtml18:Nice |
| Re: Javascript Is Very Very Powerful, It's Not Just Script. by Nobody: 10:58pm On Aug 16, 2015 |
jibolash:THANK YOU JOOOR!! Implementing pure node but having a little interest on nodeJS these days. |
| Re: Javascript Is Very Very Powerful, It's Not Just Script. by Nobody: 10:59pm On Aug 16, 2015 |
dhtml18:Thank you 4 that point |
| Re: Javascript Is Very Very Powerful, It's Not Just Script. by Nobody: 2:24am On Aug 17, 2015 |
You are welcome people |
| Re: Javascript Is Very Very Powerful, It's Not Just Script. by Olumyco(m): 11:40pm On Aug 17, 2015 |
micodon:I can get u. Is like this is becoming more interesting and seriously I am really gaining. Thumbs up Micodon, dhtml18 I will like to react further on the issue of Compiler and Interpreter. Also Categories of Languages. I think where the problem still lies is the machine code issue/storage issue and will like to dwell much on them. To me I can say We have the following Structure; -Interpreter -JIT/AOT Compiler -Conventional Compiler INTERPRETER As for Interpreter it interprets/parses/converts the source code/intermediate code to machine code without storing it. That is why each time the code is run, it converts it again to machine code. The machine code are never stored anywhere on the system. "I want to add this to the meaning of Compilation. Compilation significantly differs from interpretation or converting in the sense that when compilation is done machine codes are stored in a file or in memory. When interpretation is done machine codes are never stored. Interpreters just read the code line by line and parse it converting it to machine code but never store it. JIT COMPILER JIT Compiler compiles source code or intermediate code (like bytecode, MSIL) to machine code and store it in memory. That is it "cache" it. I believe we understand "Cache". In Computer Storage Technology, one of the least rudimentary computer storage is Cache. JIT does not only do compilation but also interpret the source code/intermediate code at runtime at first run to at least third run of the code. In operation, JIT Compiler interprets the source code/intermediate code and at thesame time compiles the code. After two or three runs, JIT Compilers no longer interprets, it just straight away run the code in the machine code already cached. Conventional Compilers These Compilers compile all the source code/intermediate code and store them in a file on the system. For example: For C Language: When you code in C you save as .c extension like app.c When you give this file "app.c" to a C - Compiler it first create a file called app.o Then it begins to read your codes and compiles them storing them into app.o Note: Your .o extension means Object File. Now that the compiler has stored the machine code (like x86 cpu code) into app.o then it can then run the code directly from app.o About .exe files, a "linker" is used to connect the object file containing the machine code (app.o) with the .exe file like app.exe for execution. For Java Language: When you code in Java, you save as .java extension like app.java When Java Compiler like "javac" the most used handles the app.java, it first create a file of .class extension like app.class Then it reads the code and compiles it to byte-code by storing the byte-code inside app.class file. The work of "javac" in Java Development Kit (JDK) ends as soon as it compiles Java Source Code to byte-code and stores them inside app.class. Then Java Virtual Machine (JVM) in Java Runtime Environment (JRE) takes it from the point at which the Compiler stop and run the byte-code by interpreting/parsing/converting it to machine code just as explained above under Interpreters. Therefore, app.class containing byte-code is run directly by JVM Interpreter. Simply put, In Java Programming two things happen. 1. Java Source Code is compiled to byte-code 2. Byte-code is interpreted at runtime. @ Micodon this is the area I was expecting you to hit when I asked you under which category will you classify Java and C#, because the two of them compiles to an intermediate code by storing them in a file system and also interprets the intermediate language. So when one talks about compiled languages the duo can fit in. When you talk about interpreted languages the duo too fit in. The cunning way of JIT compilers comes in here as it also compiles and interprets. And the difference is clear that JIT stores in memory while conventional compilers stores inside a file system. Also, JIT storage technique is not done once like conventional complilers. JIT stores procedurally by getting the functions that is run and compile them to machine code. Just as Micodon said which is the basic principle behind JIT compiler, 'it is used to optimize the performance of interpreters, so that when the code is run more than once it can optimize it for the subsequent runs. "Anyway at your discretion" To be on the safer side, I believe we can say; Compiled languages, Interpreted languages and Hybrid Languages (Compiled and Interpreted) Finally, just as I have said any language can be compiled or interpreted. Anybody can work on JavaScript Programming to do compilation by storing in a file system. One can develop a compiler that will create a file to store machine code and run the JavaScript code directly from the file containing the cpu code. But without that for now our JIT/AOT Compilers have helped solved the issue of slow - slow. Observation: JIT Compiler does not compile only byte-code. Like V8 Engine, its JIT Compiler compiles directly to machine code. JVM JITs, Rhino etc are the once I know that do that. Thanks. |
| Re: Javascript Is Very Very Powerful, It's Not Just Script. by micodon(m): 3:04am On Aug 18, 2015 |
Olumyco:The key is: Precompilation. Languages that are precompiled by the developer are generally called compiled languages |
| Re: Javascript Is Very Very Powerful, It's Not Just Script. by micodon(m): 3:12am On Aug 18, 2015 |
And take note that compiling to Java Bytecode is not just a Java implementation. With Java's bytecode loader specifications, you can write a compiler to compile any language to java bytecode for the JVM. that's how languages like groovy, Scala and Clojure works. Java can be compiled directly into native code by the developer if he so wishes. but compiled code may not be platform independent. hence, the JVM |
Lets Start A Real Web-deveopment Course Here Html+css+javascript+php+mysql • Why Javascript Is The Best Programing Language • Were Can I Download Free Video Tutorials On Javascript Or Ruby • 2 • 3 • 4
A Website With All Algorithm Solutions (my Project) • Complete Array Of Countries And Nigerian States [open Source] • Future Of Software Development In Nigeria In The Next 15 Years