-
Notifications
You must be signed in to change notification settings - Fork 30
0.4.5 update #15
base: master
Are you sure you want to change the base?
0.4.5 update #15
Conversation
The generated parsers do not leak. Since the nodes are cyclic, mark a freed node with -1. Also free temp yyqq buffers. Sequences and Alternates still leaking. Add a Variable node for the name
provide a default yyparse_new create better indented c code cleanup parser memory add yyprintfokrule, yyprintfvokrule, yyprintfvfailrule fix greg.c bootstrap. edit greg-new.c and compile.c for bootstrapping and do make greg-new remaining leaks: 16kb in Alternates,Sequences default yyerror filename "<stdin>" => "-" remove G from YY_ERROR and YY_INPUT 1st arg use G->input as new default input stream for YY_INPUT and YY_ERROR initialize input, filename, lineno in parse_new add filename to yyparse for diagnostics yyqq: escape % to %% add Node Variable for the variable names
skip -vv verbose printing for typical lexer rules
This fixes potion using a different prefix
almost all leg samples build and work now, just test.leg not add predicates have access to yytext from git-svn-id: http://piumarta.com/svn2/peg/trunk@92 4d4069a9-7f2f-0410-87d9-cbc5f9740c0a (peg-0.1.13) revert yyerror changes: now along peg/leg upstream, just file:line at the end (as in perl) improve yyinit(&g): memset(0), not memcpy malloced g so pair yyinit with yydeinit with stack allocated G, or yyparse_new/yyparse_free with heap allocated G
use readChar and helpers from peg-0.1.13 use __inline on Win32 improve Predicate layout update Query from peg: use readable names, fix test.leg: ending Alternate label
use the upstream peg error Action block feature, get rid of the added errblock field from every node. add erract sample and testcase
from git-svn-id: http://piumarta.com/svn2/peg/trunk@52 4d4069a9-7f2f-0410-87d9-cbc5f9740c0a
…o be declared in C89 from git-svn-id: http://piumarta.com/svn2/peg/trunk@51 4d4069a9-7f2f-0410-87d9-cbc5f9740c0a This is now matching peg-0.1.13
seperates -DP from -Dp in frontends (parser rules, from parser matches, from lexer matches)
Thanks for the (huge) PR — I'll have to check how well nagaqueen fares on your version. When you mean 'proper' error blocks, do you mean that they behave the same, but that instead of being attached to every kind of node, they're just a node of their own now? (hence smaller memory footprint, etc.) I haven't had time to understand all the changes yet. |
yes, 'proper' error blocks mean 1. only one special Error node and action instead re Makefile 3rd line: hmm, since it's only commented I thought of leaving it there. |
Yup, I noticed a few things were borrowed from upstream. What I'm really wondering is how functionally equivalent they are. An incompatible change would be painful for both nagaqueen & other greg users. |
The only incompatibility is:
upstream leg always used to differ from our YY_ERROR and YY_INPUT. |
See that's why I think more details are needed in your changelog, along with migration instructions for users. And any rename fo internal struct members might need to be documented if they could have been used. For example, the YY_INPUT in NagaQueen does need the _GREG struct because it has this 'read routine' thing that allows reading from file or from a memory block in a cross-platform fashion: https://github.com/nddrylliog/nagaqueen/blob/master/grammar/nagaqueen.leg#L136 - it that can't be done with your 0.4.5 update, that's a step back. I'm all for getting closer to (or at least keeping track of) Ian's changes, but I want to see the implications. |
The only action for greg users is to remove the 1st G arg from YY_ERROR and YY_INPUT. Rationale: Whenever YY_ERROR and YY_INPUT is used there already is G available, there's no need to
The required patch for nagaqueen.leg is as follows:
|
I'll revert the YY_INPUT and YY_ERROR api changes, so that the impact will be minimal. I'm persuaded. |
no it's okay, the diff you provided for nagaqueen looks good, I just haven't had time to merge it yet. I will soon. |
@rurban Your version seems to work fine with the nagaqueen patch you've provided, which is cool with me. However, I've tried (unsuccessfully) to merge your changes with the changes we've had on this repo - our forks have diverged, please rebase your changes on the latest master here so that it applies cleanly. (For clarification: I spent about an hour resolving merge conflicts and when I was done, I got a greg that segfaults - I'm just not that well-versed in greg anymore to know what's going on exactly, nor do I have the time. Since you're proposing a lot of changes/fixes I think it's only fair if you do the merging yourself.) |
e@rurban what's the current status about this? |
Please hold. I tried to make greg safe for GC usage (re-entrant eval), but On Mon, Nov 18, 2013 at 5:38 PM, Tokuhiro Matsuno
Reini Urban |
ping? |
Highlights:
less memory leaks, default parse_new
default yyerror filename "" => "-"
remove G from YY_ERROR and YY_INPUT 1st arg
initialize input, filename, lineno in parse_new
skip -vv verbose printing for typical lexer rules
add main in default trailer with -DYY_MAIN, build samples
add improvements from upstream peg-0.1.13:
add predicates have access to yytext
use __inline on Win32
proper ~{ error } block
use C89 escape for ESC
enclose user actions in braces to allow local variables to be declared in C89