Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrspeaker/js.scala
Compiles JavaScript code to Scala, allowing you to write your web application entirely in JavaScript!
https://github.com/mrspeaker/js.scala
Last synced: 19 days ago
JSON representation
Compiles JavaScript code to Scala, allowing you to write your web application entirely in JavaScript!
- Host: GitHub
- URL: https://github.com/mrspeaker/js.scala
- Owner: mrspeaker
- Created: 2015-03-03T18:30:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-19T15:18:49.000Z (over 9 years ago)
- Last Synced: 2024-10-10T22:48:46.671Z (about 1 month ago)
- Language: JavaScript
- Size: 99.6 KB
- Stars: 11
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JS.scala
JS.scala compiles JavaScript code to Scala, allowing you to write your web application entirely in JavaScript!
*Input*
const a = 42
const b = "Hello, World"
const sq = x => x * x
const dsq = x => {
const dx = sq(x)
return dx * dx
};
const d = dsq(a)const exclaimer = {
apply: name => name + "!"
}exclaimer.apply("Hello, World")
*Output*
val a = 42
val b = "Hello, World"
def sq (x:HandHolder) = x * x
def dsq (x:HandHolder) = {
val dx = sq(x)
dx * dx
}
val d = dsq(a)
object exclaimer {
def apply (name:HandHolder) = name + "!"
}exclaimer("Hello, World")
## Types
Next step is to add Flow type inference (https://github.com/facebook/flow) types to AST to restrict the expressive power of JavaScript, but export valid Scala. For now it just replaces types with a "HandHolder" place holder.