Comments (9)
Try:
test
: HELLO WORLD ;
On Wed, Oct 22, 2014 at 2:41 PM, flip111 [email protected] wrote:
I have my test file like this
//option namespace:someNamespace
//option class:someClass
//option fileName:out.php
//option extends:someExtend
//option parserValue:someParser//Lexical Grammar
%lexHELLO hello
WORLD world//Create tokens from lexical analysis
%%
HELLO {
return 'hi';
}WORLD {
return 'planet';
}/lex
%%
test
: HELLO WORLDWhen i run jison it returns:
Executing: jison test.jison
Failed: 8Is this a mistake of the grammar or another thing that is going wrong
entirely??—
Reply to this email directly or view it on GitHub
https://github.com/robertleeplummerjr/jison/issues/4.
Robert Plummer
from bovid.js.
this helped a little bit i guess ..
Executing: jison test.jison
Opening newly created jison js file: test.js
Something went bad
what does that mean?
from bovid.js.
just execute jison test.jison and ensure it is working before trying it
with ports.
On Wed, Oct 22, 2014 at 2:52 PM, flip111 [email protected] wrote:
this helped a little bit i guess ..
Executing: jison test.jison
Opening newly created jison js file: test.js
Something went badwhat does that mean?
—
Reply to this email directly or view it on GitHub
https://github.com/robertleeplummerjr/jison/issues/4#issuecomment-60135542
.
Robert Plummer
from bovid.js.
That test file didn't work, i corrected it to this
test.jison
//option namespace:someNamespace
//option class:someClass
//option fileName:out.php
//option extends:someExtend
//option parserValue:someParser
//Lexical Grammar
%lex
//Create tokens from lexical analysis
%%
hello { return 'HELLO'; }
world { return 'WORLD'; }
\s+ {/* skip whitespace */}
/lex
%%
test
: HELLO WORLD ;
input.txt
hello world
Executed commands:
jison test.jison
node test.js input.txt
This gave no error so i assume everything went succesful. However i don't know yet how i can access the generated AST.
Using those files like that and trying it with the php port:
D:\dev\console\jisonTest>node %APPDATA%\npm\node_modules\jison\ports\php\php.js test.jison
Executing: jison test.jison
Opening newly created jison js file: test.js
Something went bad
from bovid.js.
What happens when you execute jison test.jison?
On Fri, Oct 24, 2014 at 2:55 PM, flip111 [email protected] wrote:
That test file didn't work, i corrected it to this
test.jison
//option namespace:someNamespace
//option class:someClass
//option fileName:out.php
//option extends:someExtend
//option parserValue:someParser//Lexical Grammar
%lex//Create tokens from lexical analysis
%%
hello { return 'HELLO'; }
world { return 'WORLD'; }
\s+ {/* skip whitespace */}/lex
%%
test
: HELLO WORLD ;input.txt
hello world
Executed commands:
jison test.jison
node test.js input.txtThis gave no error so i assume everything went succesful. However i don't
know yet how i can access the generated AST.Using those files like that and trying it with the php port:
D:\dev\console\jisonTest>node %APPDATA%\npm\node_modules\jison\ports\php\php.js test.jison
Executing: jison test.jisonOpening newly created jison js file: test.js
Something went bad—
Reply to this email directly or view it on GitHub
https://github.com/robertleeplummerjr/jison/issues/4#issuecomment-60433080
.
Robert Plummer
from bovid.js.
nothing visible in console (one empty line to be precise)
D:\dev\console\jisonTest>jison test.jison
D:\dev\console\jisonTest>
from bovid.js.
I looked at the calculator example and i noticed it was using some extra commands typeof console !== 'undefined' ? console.log($1) : print($1); return $1;
. So i added that into my file and now i get output hello
. Ok not hello world
.. so there is still something wrong but at least it's parsing it without errors and i get some result.
//option namespace:someNamespace
//option class:someClass
//option fileName:out.php
//option extends:someExtend
//option parserValue:someParser
//Lexical Grammar
%lex
//Create tokens from lexical analysis
%%
hello { return 'HELLO'; }
world { return 'WORLD'; }
\s+ {/* skip whitespace */}
/lex
%%
test
: HELLO WORLD {
typeof console !== 'undefined' ? console.log($1) : print($1);
return $1;
};
As for the PHP version it still doesn't work.
from bovid.js.
Hi i found the bug. This line assumes that the input file lines are terminated by \n
but in my case they are terminated by \r\n
. Then later the filename out.php
is replaced by out.php\r
and windows can not write a filename like this so the error occurs.
from bovid.js.
Nice find, we should then handle both windows and linux lines.
On Sat, Nov 1, 2014 at 1:25 PM, flip111 [email protected] wrote:
Hi i found the bug. This line
https://github.com/robertleeplummerjr/jison/blob/master/ports/php/php.js#L91
assumes that the input file lines are terminated by \n but in my case
they are terminated by \r\n. Then later
https://github.com/robertleeplummerjr/jison/blob/master/ports/php/php.js#L92-L98
the filename out.php is replaced by out.php\r and windows can not write a
filename like this so the error occurs.—
Reply to this email directly or view it on GitHub
https://github.com/robertleeplummerjr/jison/issues/4#issuecomment-61375715
.
Robert Plummer
from bovid.js.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bovid.js.