Practice BFN with nodebnf parse codekit "@codekit-prepend,@codekit-append" expression. see http://incident57.com/codekit/help.php#help-imports-warning
Created
June 15, 2012 09:59
-
-
Save mashihua/2935701 to your computer and use it in GitHub Desktop.
Practice BFN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<syntax> ::= <expression> | <expression> <crlf> <syntax> | |
<crlf> ::= <_crlf> | <_wsp> <_crlf> | ";" <_crlf> | <_wsp> ";" <_crlf> | ";" <_wsp> <_crlf> | |
<expression> ::= <codekitcode> | <javascript> | |
<codekitcode> ::= <statements> <files> <semicolons> | |
<files> ::= <file> | <file> "," <file> | |
<file> ::= <_wsp> <_literal> | |
<semicolons> ::= "" | ";" | |
<statements> ::= "@codekit-append" | "@codekit-prepend" | |
<javascript> ::= "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@codekit-prepend "someFile.js" | |
@codekit-append "someFile.js" | |
@codekit-append "someFile.js"; | |
@codekit-append "someFile.js", "a.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var events = { "files":function( token ){ | |
var files = token.text; | |
files && console.log(files); | |
} }; | |
var parser = null; | |
var Compiler = require('bnf').Compiler; | |
var compiler = new Compiler(); | |
compiler.CompileScript( __dirname + "/codekit.bnf", "codekit", function( interpreter ){ | |
var parser = compiler.CreateParser( interpreter, events ); | |
parser.ParseScript( __dirname + "/codekit.js" ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name" : "PracticeBFN" | |
, "version" : "0.0.1" | |
, "description" : "My BFN exercises" | |
, "dependencies": { | |
"nodebnf" : "git://github.com/navstev0/nodebnf.git" | |
} | |
, "bin" : "./index.js" | |
, "engines" : { "node" : ">=0.6.0" } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment