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: 2 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 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-19T15:18:49.000Z (about 10 years ago)
- Last Synced: 2025-02-28T10:33:26.258Z (4 months 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.