Comments (4)
I'm so sorry for the delay, somehow my Git notifications are not getting classified correctly. I need to change my email settings. I will need to get back to you on this in the evening.
PS: I am doing some heavy optimization in another branch, so far seeing very dramatic speed ups.
from myna-parser.
It's alright, I understand, we're all busy. I have plenty to do until you have time to get back to me on this. I'm mostly playing around with this stuff.
I'm glad to hear there are improvements on the way because:
- enhancements always seem to be an adventure
- I've been running a JSON parsing comparison of Myna, Chevrotain, Parsimmon, and a state machine processor I'm working on and Myna has been performing on the low end. I was waiting to hear about this Delay thing before mentioning it, but, you brought it up, so I thought I'd throw it out there.
Have a good day.
from myna-parser.
@elidoran I removed IDs in the latest version of Myna. In order to achieve what you wanted originally, would require that you augment your parse tree after creation with IDs created from the names. I hope this doesn't make your work too much harder.
from myna-parser.
Well, that's one way to go :)
Adapting it was easy. Instead of using the ID's it made I simply assigned ID's to them.
The Delay was still a problem tho. It is called more than once instead of resolving the first time.
So, I cached the choice()
it is creating to return in the subsequent call.
Also, the first AST node matching the delayed rule does not have the ID set in its rule
. So, I have to match that via its name the first time. After that, it has the ID on it.
Relevant part:
var choice
thing = M.delay(function() {
console.log('delay()')
return choice || (choice = M.choice(...))
})
other = M.blah()
thing.id = 1
other.id = 2
// in AST tree evaluator
switch (ast.rule.id) {
case 1:
// thing: ast.rule.id is 1 the second and later times
console.log('later match ast.rule.id', ast.rule.id)
break;
case 2: /* other */ break;
default:
if (ast.rule.name === 'thing') {
// ast.rule.id is undefined the first time only.
// the next time it'll have the 1.
console.log('first match ast.rule.id is', ast.rule.id)
}
}
What I see for output is:
delay()
delay()
first match ast.rule.id is undefined
later match ast.rule.id 1
So, this is better. It only does delay() twice now and the ID works from the second time on.
Also, the newer version is faster. Great job.
from myna-parser.
Related Issues (20)
- explainjs listed as dependency
- Possible performance degradation under Chrome Canary 61 HOT 2
- Feature request: Karma and QUnit HOT 7
- Possible performance improvements HOT 2
- Add return types to standalone functions
- 2.4.0 no longer works in the browser. HOT 8
- Case insensitive keywords? HOT 5
- Myna module improperly exported
- Error recovery and continuation
- 2 small mistakes in the sample code in readme.md
- typescript declaration file absent
- Sample Usage of Myna in TypeScript HOT 7
- ParserError messages don't seem to be propogated HOT 3
- Question: how to check in sequence if there is a whitespace + symbol
- Example in the README file does not work out of the box.
- Question on requirements for the programing language you are working on. HOT 5
- How to *use* ? HOT 7
- Create railroad diagrams HOT 4
- Add Myna to JavaScript performance benchmarks HOT 2
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 myna-parser.