Comments (4)
yes, ofcourse, you may derive a new class of Lexer, just call it
type NewLexer struct {
*yyLexer;
myAST interface{},
}
pass the NewLexer instance into yyParse
so, in the parser.y, you should write lines like below:
top: prog
{
myLexer, _ := yylexer.(*NewLexer)
myLexer.myAST = $1.prog
}
from nex.
@wolfkdy Thanks for your response. I tried this sort of thing, but due my stupidity, I seem to have failed. Is there a full working example somewhere that I can try? I couldn't get the above integrated and compiling.
Thanks!
from nex.
@wolfkdy Still haven't figured this out, since while I could define a new struct, how do I pass in the stdin, etc...
from nex.
Okay, figured it out. Will post a full solution if I remember to shortly. There's a broken example in https://github.com/blynn/nex/tree/master/tacky which I modified to use .parseResult
instead of .p
in my code, and got it all working. I assume that @blynn didn't test his code before committing the example, but it looks as if the parseResult
is meant for this usage, since it isn't used elsewhere.
from nex.
Related Issues (20)
- The example with go yacc doesn't work HOT 3
- Different output on reruns HOT 2
- argument like go tool yacc's -p to change names of stuff HOT 1
- no way to change func (yylex Lexer) Error(e string) HOT 3
- nested expression question HOT 1
- ternary operators throw unexpected error HOT 1
- strange lexing behavior HOT 2
- Multiline Comments HOT 2
- Do we really need channels and goroutines? HOT 17
- May hang into inf-loop in multi-level klein-closure HOT 1
- Unmatched characters are skipped! HOT 2
- Difficulty with matching a "string" HOT 2
- Solved: How to match single line comments (using negation!)
- Case insensitive regular expressions HOT 2
- Thread safety HOT 3
- Unpaired curly inside string confuses nex HOT 1
- Size parameter should also be returned
- regex does not match with parens correctly HOT 11
- Lexer doesn't return a terminal newline token?
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 nex.