rzimmerman / kal Goto Github PK
View Code? Open in Web Editor NEWA powerful, easy-to-use, and easy-to-read programming language for the future.
Home Page: http://rzimmerman.github.io/kal
License: MIT License
A powerful, easy-to-use, and easy-to-read programming language for the future.
Home Page: http://rzimmerman.github.io/kal
License: MIT License
Example:
if me.callback isnt current_callback but not me.is_else_if
Any code included in double-quotes gets passed straight through rather than being parsed.
possibly:
obj =
a: 1
b: 2
a = [1
2
3 ]
There are lots of me.req 'IDENTIFIER'
s that don't check if the identifier is a reserved word
Example of failure:
http = require 'http'
server = http.createServer (req, res) ->
res.writeHead 200, {'Content-Type': 'text/plain'}
res.end 'Hello Worlds\n'
server.listen(3000,'127.0.0.1')
It does work with explicit parentheses:
http = require 'http'
server = http.createServer((req, res) ->
res.writeHead 200, {'Content-Type': 'text/plain'}
res.end 'Hello Worlds\n'
)
server.listen(3000,'127.0.0.1')
The following will not compile:
for key in Object.getOwnPropertyNames obj
But the following will:
for key in Object.getOwnPropertyNames(obj)
This doesn't work without the parentheses:
returnValue = Kal.eval("_=(#{code}\n)", {filename: 'repl', modulename: 'repl'})
it would be nice to have empty class definitions at least
This code would not compile:
describe 'List Comprehensions', ->
it 'should support for expressions inside list definitions', ->
a = [1,2,3,4]
b = [x+1 for x in a]
a.should.eql [1,2,3,4]
b.should.eql [2,3,4,5]
Where this would
describe 'List Comprehensions', ->
it 'should support for expressions inside list definitions', ->
a = [1,2,3,4]
b = [x+1 for x in a]
a.should.eql([1,2,3,4])
b.should.eql([2,3,4,5])
allow things like:
[a,b] = somefunction()
{x,y} = require 'thing_with_x_and_y'
Something like:
name = "Steve"
db.findByName name yields user
console.log user.id
Instead of:
name = "Steve"
db.findByName name, (err, user) ->
return err if err
console.log user.id
myfunc 12
With no newline will cause this. Explicit parens work OK.
Statements like:
if rv exists
return rv;
Threw the error:
throw e.message;
^
undefined
When compiled
return x if true
compiles correctly, however
return if true
compiles to:
return if
true
The kal
tool should be able to compile an entire directory (recursively?) in addition to just a list of files.
for example, $kindexof
vs ki$1
vs k$next
{a:1}
returns 1
, though x = {a:1}
returns {a:1}
Running npm test
with a test case that has invalid syntax causes the test suite to print the syntax error, but not mark any failures.
Parentheses don't get added to implicit function calls in the following cases:
The first argument is a regular expression
a.b /rex/g
The function object being called is the result of an array access
a.b[4] c
The following code will print 'undefined3':
rv += 3
console.log rv
Add something like the CoffeeScript REPL or Python shell.
Syntax TBD, but something like:
Number a
a = 5 #ok
a = 'c' #throws error
Object a = 'c' #ok
if 5 is a Number #true
Positive Number x = -2 #throws
It appears to be an issue only with branching wait fors:
http = require 'http'
fs = require 'fs'
server = http.createServer((req, res) ->
res.writeHead 200, {'Content-Type': 'text/plain'}
try
if req.url is '/javascript'
wait for data from fs.readFile '/Users/Rob/test.js'
else if req.url is '/kal'
wait for data from fs.readFile '/Users/Rob/test.kal'
else if req.url is '/error'
wait for data from fs.readFile '/User/Rob/doesnotexist'
else
data = 'No Data...'
res.end data
catch e
console.log e
res.end "Error: #{e}"
)
server.listen(3000,'127.0.0.1')
Try calling this server with the /error path. It does detect the error but the try block doesn't seem to cover it.
some issues observed with instanceof, which is currently not well supported. For example:
return x if a instanceof b
Many errors are not descriptive and frequently, the compiler just puts out 'expected EOF on line 1' on errors. Also, it would be nice to print the stack trace in some reasonable way.
Should be able to do this:
a not in b
In addition to the current construct:
not (a in b)
Split from gh-9
Would like to support things like:
x.run() for x in y
x = [y for y in z]
console.log k,v for k,v of obj
These operators not currently supported correctly.
a = '\n'
fails to parse
For example:
x = -3
List comprehensions support generators (classes with a next
method) but actual for loops do not.
something like:
function a() runs on server
return 1
For example:
a.push x if x
compiles to:
a.push(x if x)
should be:
a.push(x) if x
Actually remove all remnants of coffe-script now that it isn't being used.
This code will not compile:
process.on 'error', handleError
and requires parenthesis since the sugar module ignores reserved words like on
when applying parentheses
maybe only update on major releases?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.