Difference between revisions of "ProgClub.js"

From ProgClub
Jump to: navigation, search
(→‎Done: started ProgClub standard JavaScript format)
 
(7 intermediate revisions by the same user not shown)
Line 61: Line 61:
  
 
* [http://www.ecma-international.org/ecma-262/5.1/ Standard ECMA-262 5.1 Edition from June 2011]
 
* [http://www.ecma-international.org/ecma-262/5.1/ Standard ECMA-262 5.1 Edition from June 2011]
 +
* [https://google.github.io/styleguide/javascriptguide.xml Google JavaScript Style Guide]
  
 
= Specifications =
 
= Specifications =
Line 68: Line 69:
 
The functional specification describes what the project does.
 
The functional specification describes what the project does.
  
The software processes an input JavaScript file and outputs that file in the ProgClub standard JavaScript syntax. It can be run on the command-line (in [https://nodejs.org/en/ Node.js]) or in a web browser.
+
The software processes an input JavaScript file and outputs that file in the [[ProgClub standard JavaScript format]]. It can be run on the command-line (in [https://nodejs.org/en/ Node.js]) or in a web browser.
  
 
== Technical specification ==
 
== Technical specification ==
Line 96: Line 97:
 
=== Testing the pretty printer ===
 
=== Testing the pretty printer ===
  
To test the pretty printer use the [https://www.progclub.org/pcrepo/progclub.js/branches/0.1/run.sh run.sh] script:
+
To test the pretty printer on the command-line (you need a recent version of [https://nodejs.org/en/ Node.js] installed) use the [https://www.progclub.org/pcrepo/progclub.js/branches/0.1/run.sh run.sh] script:
  
 
  $ ./run.sh
 
  $ ./run.sh
 +
 +
TODO: explain how to run in a browser. Or on Windows.
  
 
= Tasks =
 
= Tasks =
Line 106: Line 109:
 
Things to do, in rough order of priority:
 
Things to do, in rough order of priority:
  
* Pretty printing
+
* Get dumb (single policy) pretty printing done
 
+
* Get smart (context aware) pretty printing done
[[Category:TODO]]
 
  
 
== Done ==
 
== Done ==
Line 114: Line 116:
 
Stuff that's done. Latest stuff on top.
 
Stuff that's done. Latest stuff on top.
  
* [[User:John|JE]] 2016-04-11: started on [[ProgClub standard JavaScript format]].
+
* [[User:John|JE]] 2016-04-11: started on [[ProgClub standard JavaScript format]] documentation.
 
* [[User:John|JE]] 2016-04-11: imported initial version from [https://www.progclub.org/pcrepo/jj5-test/trunk/ jj5-test] where it was incubated.
 
* [[User:John|JE]] 2016-04-11: imported initial version from [https://www.progclub.org/pcrepo/jj5-test/trunk/ jj5-test] where it was incubated.
 
* [[User:John|JE]] 2016-04-11: created the project in svn.
 
* [[User:John|JE]] 2016-04-11: created the project in svn.
 
* [[User:John|JE]] 2016-04-11: created project page.
 
* [[User:John|JE]] 2016-04-11: created project page.

Latest revision as of 16:18, 11 December 2017

ProgClub.js is the ProgClub JavaScript pretty printer. That's the software that formats your JavaScript code according to the ProgClub standard JavaScript format. For other projects see projects.

Status

Under way. Not released yet, there's stuff TODO.

Motivation

Why this software? Because we wanted a pretty-printer for dealing with (normalizing) the syntax used by the JsPHP upstream developers. By normalizing the code we wanted to import we could fix issues with the syntax we didn't like (they don't use semicolons!) and also make sure whitespace changes were irrelevant.

Administration

Contributors

Members who have contributed to this project. Newest on top.

All contributors have agreed to the terms of the Contributor License Agreement. This excludes any upstream contributors who tend to have different administrative frameworks.

Upstream contributors:

Copyright

Copyright 2016, Contributors.

License

Licensed under the MIT license.

Components

Libraries, tools, services or media from third parties used under license:

Resources

Downloads

No downloads at this time.

Source code

The repository can be browsed online:

https://www.progclub.org/pcrepo/progclub.js/branches/0.1

The latest stable released version of the code is available from:

https://www.progclub.org/svn/pcrepo/progclub.js/tags/latest/0.1

Or if you want the latest version for development purposes:

https://www.progclub.org/svn/pcrepo/progclub.js/branches/0.1

Links

Specifications

Functional specification

The functional specification describes what the project does.

The software processes an input JavaScript file and outputs that file in the ProgClub standard JavaScript format. It can be run on the command-line (in Node.js) or in a web browser.

Technical specification

The technical specification describes how the project works.

The project uses an ANTLR4 compiler compiler to generate an ECMAScript (Standard ECMA-262 5.1 Edition from June 2011) lexer/parser which we use in a custom processor (written in JavaScript) which formats output.

Notes

Notes for implementers

If you are interested in incorporating this software into your project, here's what you need to know:

Copy and paste your way to victory!

Notes for developers

If you're looking to set up a development environment for this project here's what you need to know:

Generating the lexer/parser

To generate the lexer/parser you need to use the ANTLR4 tool, which is a Java application. You only need to do this if you've modified the ECMAScript grammar. Run the build-parser.sh script to update the lexer/parser components:

$ ./build-parser.sh

Testing the pretty printer

To test the pretty printer on the command-line (you need a recent version of Node.js installed) use the run.sh script:

$ ./run.sh

TODO: explain how to run in a browser. Or on Windows.

Tasks

TODO

Things to do, in rough order of priority:

  • Get dumb (single policy) pretty printing done
  • Get smart (context aware) pretty printing done

Done

Stuff that's done. Latest stuff on top.