ooc-lang / greg Goto Github PK
View Code? Open in Web Editor NEWThis project forked from whymirror/greg
:ram: a recursive-descent parser generator for PEG
This project forked from whymirror/greg
:ram: a recursive-descent parser generator for PEG
First --- I apologize for the vague nature of this issue/question. I'm trying to track down the problem, but without much success. Perhaps you'll have some insight that can point me in the right direction. I'm happy to answer any follow-up questions that would be helpful.
MultiMarkdown 4 (https://github.com/fletcher/MultiMarkdown-4) uses a parser built by greg. I've designed it (I think) to be thread-safe (unlike MMD 3 which was built using peg/leg).
I also have a commercial app that is built around MultiMarkdown. To maximize performance, several of the routines using MMD run on separate threads. It seems to work great (unlike when I used a version of MMD 3 with peg/leg --- which was definitely not thread-safe). However, I have found at least one situation where things don't work properly, and it seems to be due to two routines from MMD-4 being run simultaneously. When I disable one function, the other one works properly, and vice versa. The problem doesn't occur consistently, which leads me to believe that the timing of the two threads has to be within a fairly narrow range in order for the problem to appear. (Basically one thread is converting the source text to HTML for a live preview window; the other thread is being used for syntax highlighting within the source text.)
I've gone back through the MMD-specific code that seems relevant, and I don't see anything that should cause collisions. Any potential trouble areas that come to mind? Anything that I need to be sure I'm doing? I'm running the two routines on separate copies of source text strings. Adding in a bunch of logging statements suggests that both threads are running properly, but the output structures are getting mangled somehow? The output is basically a linked list, and it seems that the lists are getting prematurely truncated.
Again, I don't expect you to be able to provide a fix with such a vage problem, but hopefully you (or someone) has experience with the reentrant/thread-safe functionality of greg and any problems that can sometimes arise. Thanks for reading this!
Fletcher
It's entirely possible that I'm being daft, or that my google-fu is failing me, but thunk->begin and thunk->end don't consistently indicate the offsets of the beginning/end of the recipe. In particular, the accuracy of nested recipes seems inaccurate. For example, matching a string that includes some whitespace at the end that I need to keep track of.
What are the rules for which components of a "recipe" are included inside the thunk begin/end offsets?
Thanks!
Current greg does not prints '#line'. It makes hard to debugging.
How can I capture characters without spaces like perl's \S?
[^ ]
does not match to non-space character.
This project seriously lacks documentation. The original peg has a nice and extensive man page – greg has no documentation ... aside from usage examples.
it seems greg needs greg to build itself ( see https://github.com/nddrylliog/greg/blob/master/Makefile#L30 ), but greg is in your gitignore ( see https://github.com/nddrylliog/greg/blob/master/.gitignore#L2 ), so I don't see any way to build greg…
I am creating a quick and dirty test program around my parser built with greg
. In order to parse the test files, it's easiest to do by building another parser.
Since both parsers are built with greg
, there are namespace collisions:
duplicate symbol _yyparse_from in:
test.o
parser.o
duplicate symbol _yyparse in:
test.o
parser.o
duplicate symbol _yyinit in:
test.o
parser.o
duplicate symbol _yydeinit in:
test.o
parser.o
duplicate symbol _yyparse_new in:
test.o
parser.o
duplicate symbol _yyparse_free in:
test.o
parser.o
Any tips on how to make this work? Surely it is possible to use more than one parser in a given program?
Any advice is appreciated!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.