Coder Social home page Coder Social logo

charlievillacr / jsx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jsx/jsx

0.0 1.0 0.0 22.41 MB

JSX - a faster, safer, easier JavaScript

Home Page: http://jsx.github.io/

License: MIT License

JavaScript 77.52% CSS 0.28% Perl 17.98% Shell 0.04% Makefile 0.15% HTML 1.05% Perl 6 2.87% GLSL 0.11%

jsx's Introduction

NAME Build Status

JSX - a faster, safer, easier JavaScript

INSTALLATION

The JSX compiler toolkit is released as a npm package, so you can install it with npm install -g jsx.

COMPILATION

There's jsx(1) command to compile JSX source code into JavaScript.

Type the following commands and see what happens:

# run Hello World in JSX
jsx --run example/hello.jsx

# compile it and output the generated code to stdout
jsx example/hello.jsx

# compile it with full optimizations
jsx --release --output hello.jsx.js example/hello.jsx

# compile it for node and execute it
jsx --executable node --output hello.jsx.js example/hello.jsx
./hello.jsx.js # displays "Hello, world!"

# run a test, calling _Test#test*()
jsx --test example/import.jsx # import.jsx has _Test

jsx --help shows how to to use the jsx command.

INTRODUCTION

Here is a fizzbuzz problem, which can be executed by jsx --run fizzbuzz.jsx, showing a basic syntax of JSX.

class _Main {
	static function main(args :string[]) : void {
		for (var i = 1; i <= 100; ++i) {
			if (i % 15 == 0)
				log "FizzBuzz";
			else if (i % 3 == 0)
				log "Fizz";
			else if (i % 5 == 0)
				log "Buzz";
			else
				log i;
		}
	}
}

See the documentation for details.

EXAMPLES

There are JSX source files in example/ and web/example/, and the the test directory t/.

DEVELOPMENT OF JSX COMPILER

If you are interested in development of the JSX compiler, you should set up your environment after cloning the repo. The SDK development requires LSB 4.1 (Perl 5.8.8 and some UNIX commands) as well as NodeJS 0.8.0 or later.

To setup JSX SDK, type the following command:

git clone --recursive git://github.com/jsx/JSX.git
cd JSX
make # to build bin/jsx
# edit JSX compiler source files
make test # to make sure it works

We recommend to install jsx(1) as a link of $JSX/bin/jsx to ~/bin/jsx.

ln -s "$PWD/bin/jsx" ~/bin

DEVELOPMENT WEB SERVER

There's a web interface, which provides a web compiler and web application examples. Type the following commands to run the server:

make server # to run an HTTP daemon
open http://localhost:2012/

This server is also used to show results of JSX profiler. See Using the Profiler for details.

TESTING

There are unit tests in t/ directory. Just type the following command to run the tests:

make test

These test cases are executed by prove(1) and dispatched by t/util/test-runner, and also requires phantomjs(1)

Note that if you make a pull request you have to make sure make test-all for complete tests.

NOTE: There are some TODO tests, which should be resolved in a future. make show-todo shows such TODOs.

WINDOWS SUPPORT

npm install -g jsx should work even on Windows.

RESOURCES

jsx's People

Contributors

gfx avatar kazuho avatar nyuichi avatar mzp avatar bleis-tift avatar mattn avatar shinriyo avatar tomykaira avatar aduros avatar chrisantaki avatar simi avatar kan avatar mootoh avatar ojwb avatar gunyarakun avatar shibukawa avatar mugenen avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.