What language apart from JavaScript can you execute in a browser - browser

Are there other languages apart from javascript that browsers can interpret and execute. I'm happy for browser specific ones as well.
Any answers welcomed

Every language for which an interpreter written in JavaScript exists: Brainfuck, Ruby (more precisely: YARV bytecode), Scheme, Clamato, many others.
Every language for which a compiler exists that compiles the language to JavaScript: C, Java, JVML bytecode, CIL bytecode, Ruby, Clojure, Scala, Objective-J, Haxe, Ur, Links, Flapjax, Caja, many others.
Every language for which a compiler exists that compiles the language to one of the languages listed above, since you can then either interpret the output of the compiler in JavaScript, or compile it again to JavaScript. (E.g. you can compile JVML bytecode to JavaScript and you can compile Ruby to JVML bytecode, ergo you can compile Ruby to JavaScript.)
Every language for which an interpreter exists as a browser plugin: JVML bytecode (Java Applets), CIL bytecode (Silverlight), ActionScript bytecode (Flash), C, many others.
Every language which can be executed by the browser directly: VBScript (in Internet Explorer), XSLT (several browsers), x86/AMD64 machine code (Chrome Native Client), many others.
See also:
What language types are allowed in the HTML script tag?
Are there other languages than Objective-J that get “compiled” to JavaScript in the browser?

VBScript in Internet Explorer, but nobody uses that. At least in the past (and maybe still), any Windows Script Host language would be executed by Internet Explorer.
As far as other web browsers... nothin' but Javascript, as far as I know.

Related

Is it possible to make a proxy between IDE and language server?

Say, I want to slightly change the behavior of some language.
Can this be done? Has it been done before?
UPD: Typescript has very limited possibilites to work with property names (for example you can not with the help of typescript create a propname that is derived from another one, e.g. uppercased or with a prefix prepended), whereas Javascript (which is what Typescript compiles to) is very flexible. So I wanted with the help of LSP to modify some of the Typescript's LSP messages that carry autocompletion options.
Yes, but how to do that is operating system specific. From the compiler's point of view, the proxy would appear as your IDE. LSP is a network protocol
I want to slightly change the behavior of some language.
So you want to change the semantics of some language (and you don't tell which). Then LSP is not the best place to do so.
For example, in some simple cases, with GCC, writing your GCC plugin is more appropriate.
In most cases, changing the "behavior" is really changing the language itself. Then you might need to make your own implementation of that language. Sometimes, you might patch an existing free software implementation of the original languages. In other cases, you'll need to make your language implementation by yourself. Then read the Dragon Book and consider compiling or transpiling to C your language in your language implementation. Be sure to specify it on paper first.
Don't confuse a programming language (which is a specification, generally written in English - perhaps with some formalization in some specific notation, e.g. n1570 for C11, R5RS for Scheme) with its implementation (which is a software). Read Scott's Programming Language Pragmatics.
Don't confuse an IDE with a language implementation. For example, all C or C++ compilers I know about don't have any IDE and are command line programs (e.g. GCC, Clang, etc...), and most of them don't even know about LSP. The IDE might start the C++ compiler, but it is not a compiler. You can code (in C, C++, Java, C#, Ocaml, ....) with a plain source code editor (even a simple language-agnostic one such as Notepad on Windows, or Leafpad or nano on Linux).
Most programming languages are defining source programs as a set of "translation units", practically of "source files", each being a sequence of characters with some complex syntax and semantics. How these source files are created is outside of the scope of the programming language specification (you could use editors, you could write your own generators for these source files, ....)
LSP is a proposal for a protocol between "IDE"s and language implementations.
Notice that autocompletion (mentioned in your comment) is not a feature of the programming language (and is not part of the semantics of C or C++). It might be a feature of some IDEs (not all of them). It could be done in a language neutral way (e.g. in Emacs).

Programming Language Implementation

In my lecture notes "Language Implementation System" is explained as,
A language implementation system provides an interface fro programs in
higher level languages to machine instructions.
And after a search Wikipedia gave me,
A programming language implementation is a system for executing
computer programs.
But I am having a hard time understanding this concept. Is it talking about something like a JVM (Java Virtual Machine)?
Can someone explain this to me in simpler terms?
I'll give it a shot.
Programming Language Implementation describes the method for how your code (such as Java) as an example is converted to a language that the machine (processor etc) understand. We refer to this as machine code.
There are 2 main forms of this, compilation and interpretation.
Technically, as the Wikipedia page points out, a compilation is converting one programming language to another (usually a lower level one). Traditionally, this refers to combining multiple input files into a single file that is runnable on the target system.
In an interpreted language, the program is converted piece by piece while it's running on your machine.
You mention the Java Virtual Machine, so I'm going to use that as an example. In the JVM, the Java code is compiled into Java bytecode using javac. This bytecode is then interpreted by the Java Virtual Machine and run on the underlying hardware. This is what the java command does. While Java could be described as a compiled and interpreted language, it's probably easier to think of Java itself as a compiled language, and Java bytecode as an interpreted language.
In contrast, other languages such as C and C++ are usually converted (compiled) directly to the machine code of the target hardware platform.
In addition to these, as #kostix pointed out in the comments, there exists transpiling, or source-to-source compiling. Transpiling refers to converting one higher level language into another higher level one. A common example is converting JavaScript ES6 to JavaScript ES5 for backwards compatibility, or C++ into JavaScript

What is Neko anyway?

I have started to use Haxe to convert my ActionScript 3 projects into NME, but, I like to know please what is Neko in the world of Linux? I searched for it, I found its an animated cat!
Can any one please explain to me?
Neko for most people is nothing more than a Haxe target. That's not technically true (it does have its own language, and could potentially be a target for other languages), but for most people, Neko is one of the Haxe output targets.
In the same way the Java Virtual Machine (JVM) can be targeted from multiple languages (See the list on wikipedia), Neko is a bytecode format that can theoretically be written to from multiple languages. For Neko however, most people seem to use Haxe to create their *.n files.
For Haxe programmers, the Neko target lets you:
Write command line tools and utilities (for example, haxelib and haxedoc are written in Haxe targeting Neko)
Write web apps or dynamic web pages - using mod_neko (or mod_tora) you get a web processor with the same sort of capabilities as PHP, but a fair bit faster.
Create games with NME (which originally started with Neko, it stands for Neko Media Engine), and compile them quickly, having a target closer to what CPP has, but which compiles a lot faster and where the output is cross platform.
A runtime that is closely tied into Haxe and can be used from within macros etc - so you can use all of the neko.* classes inside Macros.
If you're only interested in targetting SWF or JS, you'll probably not have much need for Neko. But if you are writing server side code, you'll appreciate the performance, and if you are writing CPP, you may appreciate having a simple target that is dead easy and super quick to compile, and which behaves similarly to CPP.
Of course, outside of Haxe neko is it's own language... but to me at least it seems most people just use it with Haxe.
More Info:
If you want to write in the Neko language (See this tutorial) you might save your code as "myfile.neko" and compile with nekoc myfile.neko, which will compile a Neko bytecode file "myfile.n".
If you want to write in the Haxe language, you might save your file as "MyFile.hx" and compile with "haxe -neko myfile.n -main MyFile".
The "myfile.n" that is generated by both of these doesn't have human readable source code - this is the Neko bytecode. You can run it on any computer that has Neko installed by running neko myfile.n. You can turn it into an executable (that runs without Neko installed) for your platform/OS by running nekotools boot myfile.n.
Here is a tutorial on Getting Started With Neko, which covers both command line programs you write and (very very basic) web pages.
"Neko" is Japanese for "cat", which is probably why you found what you did.
Neko is also a virtual machine (a "VM") like the Java Virtual Machine ("JVM") or the .Net Common Language Runtime (".Net CLR").
Neko has a custom high-level language made as an easily targeted language backend (like C-- in a way, but not like LLVM, which is closer to an assembly language). In other words: It's something that a programming language can be translated into rather than a more involved "full" compilation (like to assembly, to bytecode, or to machine code). Neko's language can be translated into a bytecode, which is portable and is usually stored in a ".n" file.
Neko was made by Nicolas Cannasse (the same person that made the Haxe Programming language), which is probably why Haxe has a Neko target in its compiler, and the Haxe tools, such as "haxelib" use it. Because the tools are compiled into ".n" files, they only need to be built once, and then they work on any platform with the VM executable "neko" installed.
Perhaps a more interesting bit about neko, and why you should learn it for Haxe development is that it's the runtime used for compile-time macros. See this tutorial for how part of your program can be run at compile time with full access to the build machine, which means you could even do complex tasks, such as parse a data file, at compile time.
Neko provides a common runtime for several different languages, including javascript and haxe. the compiler converts a source file (.neko) into a bytecode file (.n) that can be executed with the virtual machine. you can use the compiler as standalone commandline executable separated from the virtual machine, or as a neko library to perform compile-and-run for interactive languages. neko was written by nicolas cannasse.
you can find Neko Tutorial here

What is difference between scripting languages and other languages [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
When is a language considered a scripting language?
I am really confused between different types of languages.
Can any one guide what are diff types of languages or diff categories.
Like some saying python is scripting langauge. Now what does that mean. Are other langueages like php , asp , java not scripting langauges
The name "Scripting language" applies to a very specific role: the language which you write commands to send to an existing software application. (like a traditional tv or movie "script")
For example, once upon a time, HTML web pages were boring. They were always static. Then one day, Netscape thought, "Hey, what if we let the browser read and act on little commands in the page?" And like that, Javascript was formed.
A simple javascript command is the alert() command, which instructs/commands the browser (a software app) that is reading the webpage to display an alert.
Now, does alert() related, in any way, to the C++ or whatever code language that the browser actually uses to display the alert? Of course not. Someone who writes "alert()" on an .html page has no understanding of how the browser actually displays the alert. He's just writing a command that the browser will interpret.
Let's see the simple javascript code
<script>
var x = 4
alert(x)
</script>
These are instructs that are sent to the browser, for the browser to interpret in itself. The programming language that the browser goes through to actually set a variable to 4, and put that in an alert...it is completely unrelated to javascript.
We call that last series of commands a "script" (which is why it is enclosed in <script> tags). Just by the definition of "script", in the traditional sense: A series of instructions and commands sent to the actors. Everyone knows that a screenplay (a movie script), for example, is a script.
The screenplay (script) is not the actors, or the camera, or the special effects. The screenplay just tells them what to do.
Now, what is a scripting language, exactly?
There are a lot of programming languages that are like different tools in a toolbox; some languages were designed specifically to be used as scripts.
Javasript is an obvious example; there are very few applications of Javascript that do not fall within the realm of scripting.
ActionScript (the language for Flash animations) and its derivatives are scripting languages, in that they simply issue commands to the Flash player/interpreter. Sure, there are abstractions such as Object-Oriented programming, but all that is simply a means to the end: send commands to the flash player.
Python and Ruby are commonly also used as scripting languages. For example, I once worked for a company that used Ruby to script commands to send to a browser that were along the lines of, "go to this site, click this link..." to do some basic automated testing. I was not a "Software Developer" by any means, at that job. I just wrote scripts that sent commands to the computer to send commands to the browser.
Because of their nature, scripting languages are rarely 'compiled' -- that is, translated into machine code, and read directly by the computer.
Even GUI applications created from Python and Ruby are scripts sent to an API written in C++ or C. It tells the C app what to do.
There is a line of vagueness, of course. Why can't you say that Machine Language/C are scripting languages, because they are scripts that the computer uses to interface with the basic motherboard/graphics cards/chips?
There are some lines we can draw to clarify:
When you can write a scripting language and run it without "compiling", it's more of a direct-script sort of thing. For example, you don't need to do anything with a screenplay in order to tell the actors what to do with it. It's already there, used, as-is. For this reason, we will exclude compiled languages from being called scripting languages, even though they can be used for scripting purposes in some occasions.
Scripting language implies commands sent to a complex software application; that's the whole reason we write scripts in the first place -- so you don't need to know the complexities of how the software works to send commands to it. So, scripting languages tend to be languages that send (relatively) simple commands to complex software applications...in this case, machine language and assembly code don't cut it.
A scripting language is typically interpreted instead of compiled.
See scripting-and-programming,
whats-the-difference-between-a-script-and-an-application
and many similar discussions.
There are many taxonomies for classifying programming languages.
In regard to scripting, a scripting language (python, ruby, php) is a language that runs on an interpretor directly from source code.
Other languages are either compiled languages (run from binary form: c, c++, pascal) either intermediate, compiled to an intermediary form and run inside a virtual machine (java, c#).
A scripting language is a language that focuses on making it easy to chain together or manipulate other programs
Wikipedia says:
"When a language is used to give commands to a software application (such as a shell) it is called a scripting language"
"A scripting language, script language or extension language is a programming language that allows control of one or more software applications."
This is orthogonal from whether it is interpreted or otherwise - Java was originally interpreted, for example, but nobody called it a scripting language. It just happens that, if you're implementing a scripting language, interpreting it is a straightforward approach to take.
Many scripting languages are compiled, either to bytecode or to machine code, often with JIT.
The distinction between script languages and other languages is mostly between interpreted, dynamically typed languages (for example PHP, VBScript, JScript and Javascript), and compiled, statically typed languages (for example C#, VB.NET, Java, C++ and Delphi).
ASP is not a language, but a platform for scripting languages (VBScript / JScript), while ASP.NET is a platform for compiled languages (mainly C# / VB.NET).

Programming languages with python-like syntax but native code generation

Can anyone point to programming language which has python-like syntax, but from the very beginning was designed to generate native code? I'm aware of Boo only, but it uses .net, not native code generation. Well, if nothing else than python-like languages which generate .net/java bytecode are fine too.
Cython might do -- the C code it generates is for Python extensions, but the whole thing can be packaged up and you'll be running native code throughout (after the 'import';-).
I must admit that I don't quite understand your question, for two reasons:
You are asking for a language with native code generation, but native code generation has nothing to do with the language, it is a trait of the implementation. Every language can have an implementation with native code generation. Several Python implementations have native code generation. There are C compilers that compile to JVM bytecode, CIL bytecode or even ECMAScript sourcecode. There are even C interpreters. There are also compilers that compile Java sourcecode or JVM bytecode to native code.
Why do you care about the syntax? It is probably the least important factor about choosing a programming language.
Anyway, Nim is a programming language which has an implementation which supports native code generation (or more precisely an implementation which supports C source code generation) and whose syntax is a hybrid between Wirthian style (by the looks of it the most important influences are Oberon and Delphi) and Python.
However, the fact that it has Pythonic syntax isn't going to help you at all if you don't like European style language design or Wirthian style OOP.
Also found today Delight applying Python syntax on a D back-end.
And Converge too.
Check out Cobra
It is strongly influenced by Python, C#, Eiffel, Objective-C and other programming languages. It supports both static and dynamic typing. It has first class support for unit tests and contracts. Cobra provides both rapid development and performance in the same language.
shedskin compiles Python to C++
From shedskin project page
Shed Skin is an experimental compiler,
that can translate pure, but
implicitly statically typed Python
programs into optimized C++. It can
generate stand-alone programs or
extension modules that can be imported
and used in larger Python programs.
Genie which is part of the gnome project: http://live.gnome.org/Genie
I think it's exactly what you're looking for.
If you are happy with something that compiles down to Java bytecode you could have a look at Jython. Quoting from their FAQ:
JPython is an implementation of the Python programming language which is designed to run on the Java(tm) Platform. It consists of a compiler to compile Python source code down to Java bytecodes which can run directly on a JVM, a set of support libraries which are used by the compiled Java bytecodes, and extra support to make it trivial to use Java packages from within JPython.
I've not actually used it yet but am considering it on some projects where I have to integrate with existing an Java codebase.
HTH
PyPy is a project to re-implement Python in Python. One of it's goals is to allow the use of multiple back-ends, including C. So you can take a pure Python program, convert it to C and compile it to native code. It is still a work in progress, so probably not suitable for production code.
You can find all of the previously mentioned languages, plus some more, here: http://wiki.python.org/moin/PythonImplementations
Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula.
https://nim-lang.org/
You can also investigate IronPython - a python inplementation on the .NET framework
You can try Genie. It's the same like Vala, but with Python-like syntax. If you want to develop apps for Linux with GTK, and you want to compile it to native app, Vala or Genie is really good choice.

Resources