Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Commit

Permalink
updated version number and notes
Browse files Browse the repository at this point in the history
  • Loading branch information
alxlit committed Aug 3, 2012
1 parent 0cf4f57 commit 19eca69
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ compiler to PHP.

## Status

CoffeeScript version **1.1.1** has been fully ported over (see
CoffeeScript version **1.3.1** has been fully ported over (see
[tags](http://github.com/alxlit/coffeescript-php/tags)). Compiled code nearly
matches the reference 100%, except for the occasional extra newline. Tons of
`E_STRICT` problems.

Work towards porting version 1.3.1 and making it `E_STRICT` is taking place
on the master branch.
matches the reference 100%, except for [#11](https://github.com/alxlit/coffeescript-php/issues/11)
(a good thing).

## Requirements

Expand All @@ -22,7 +19,6 @@ PHP 5.3+ (uses namespaces, anonymous functions).
It's recommended that you use [Composer](http://getcomposer.org) to install
and autoload CoffeeScript. Alternatively you can load it manually:


```php
<?php

Expand All @@ -36,17 +32,20 @@ CoffeeScript\Init::load();

## Usage

At the moment the API is pretty basic. It'll probably be expanded a bit in the
future.
The API is really basic (single `compile` function). I don't plan on expanding
it further (keep it simple).

```php
<?php

$coffee = file_get_contents('path/to/source.coffee');
$file = 'path/to/source.coffee';

try
{
$js = CoffeeScript\Compiler::compile($coffee);
$coffee = file_get_contents($file);

// See available options below.
$js = CoffeeScript\Compiler::compile($coffee, array('filename' => $file));
}
catch (Exception $e)
{
Expand All @@ -56,13 +55,27 @@ catch (Exception $e)
?>
```

Available options:

* **filename** - The source filename, formatted into error messages
* **header** - Add a "Generated by..." header
* **rewrite** - Enable the rewriter (debugging)
* **tokens** - Reference to token stream (debugging)
* **trace** - File to write parser trace to (debugging)

## Development

To rebuild the parser run `php make.php`. Tests are run in the browser; simply
clone the repository somewhere Apache can see it and navigate to tests/.

## FAQ

#### What was the motivation for this project?

I was using PHP a lot at the time and wanted to use, learn more about, and
potentially contribute back to the CoffeeScript project. I thought it'd be nice
to have a native version gave it a shot.

#### Why not modify the original compiler to emit PHP?

The compiler itself depends on Jison, which is written in JavaScript, so you'd
Expand Down

0 comments on commit 19eca69

Please sign in to comment.