Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Issue 15801003: IDL parser rewrite in Python (Closed)

Created:
7 years, 6 months ago by Nils Barth (inactive)
Modified:
7 years, 5 months ago
CC:
blink-reviews, caseq+blink_chromium.org, aandrey+blink_chromium.org, loislo+blink_chromium.org, jsbell+bindings_chromium.org, eustas+blink_chromium.org, alph+blink_chromium.org, eae+blinkwatch, yurys+blink_chromium.org, lushnikov+blink_chromium.org, abarth-chromium, vsevik+blink_chromium.org, pfeldman+blink_chromium.org, Rik, apavlov+blink_chromium.org, adamk+blink_chromium.org, Nate Chapin, kojih, dominicc (has gone to gerrit)
Visibility:
Public.

Description

IDL parser rewrite in Python The parser etc. steps are: 1. lexer (blink_idl_lexer.py) 2. parser (blink_idl_parser.py), yields AST 3. build Python object (idl_definitions_builder.py) The lexer is very simple (just tweaks base Pepper lexer). The parser is just grammar. It is in BNF + PLY's dialect of yacc, so the syntax looks a bit unfamiliar, but I've got detailed comments to explain how to read it. Most of the logic is in idl_definitions_builder.py, which converts the AST to a Python object. It's straightforward but long. idl_definitions.py is mostly JSON export (for verification), which has several Perl hacks to produce identical output. There's also the extended attribute validation in idl_validator.py. There is a bit of testing cruft in derived_sources.gyp and idl_compiler (to make JSON and pickles), which I'll take out before landing. For reference, the base (Pepper) IDL lexer + parser are: src/tools/idl_parser/idl_lexer.py src/tools/idl_parser/idl_parser.py https://code.google.com/p/chromium/codesearch#chromium/src/tools/idl_parser/idl_lexer.py https://code.google.com/p/chromium/codesearch#chromium/src/tools/idl_parser/idl_parser.py BUG=242795 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=154633

Patch Set 1 #

Patch Set 2 : [WIP] Full parser #

Patch Set 3 : [WIP] Full parser #

Total comments: 14

Patch Set 4 : [WIP] (Reference for build changes) #

Patch Set 5 : WIP (pre-rebase) #

Patch Set 6 : Ready for review! #

Patch Set 7 : Ready for review! (cleaner) #

Total comments: 153

Patch Set 8 : Revised. #

Patch Set 9 : Revised. #

Total comments: 88

Patch Set 10 : Final #

Patch Set 11 : Final (rebased). #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1671 lines, -60 lines) Patch
M Source/bindings/derived_sources.gyp View 1 2 3 4 5 6 7 8 9 3 chunks +16 lines, -2 lines 2 comments Download
A Source/bindings/scripts/blink_idl_lexer.py View 1 2 3 4 5 6 7 1 chunk +92 lines, -0 lines 0 comments Download
A Source/bindings/scripts/blink_idl_parser.py View 1 2 3 4 5 6 7 8 9 1 chunk +367 lines, -0 lines 0 comments Download
M Source/bindings/scripts/idl_compiler.py View 1 2 3 4 5 6 7 3 chunks +27 lines, -8 lines 0 comments Download
A Source/bindings/scripts/idl_definitions.py View 1 2 3 4 5 6 7 8 9 1 chunk +454 lines, -0 lines 0 comments Download
A Source/bindings/scripts/idl_definitions_builder.py View 1 2 3 4 5 6 7 8 9 1 chunk +519 lines, -0 lines 0 comments Download
M Source/bindings/scripts/idl_reader.py View 1 2 3 4 5 6 7 8 9 1 chunk +16 lines, -32 lines 0 comments Download
A Source/bindings/scripts/idl_validator.py View 1 2 3 4 5 6 7 8 9 1 chunk +110 lines, -0 lines 0 comments Download
M Source/bindings/scripts/interface_dependency_resolver.py View 1 2 3 4 5 6 7 8 9 4 chunks +70 lines, -18 lines 0 comments Download

Messages

Total messages: 35 (0 generated)
Nils Barth (inactive)
Hi Haraken, Here's a working lexer + parser, with tests. It should be easy to ...
7 years, 6 months ago (2013-05-28 05:29:32 UTC) #1
abarth-chromium
Can we remove the use of the preprocessor from the IDL files? It seems like ...
7 years, 6 months ago (2013-05-28 06:32:33 UTC) #2
abarth-chromium
How does the performance of the new parser compare to the old parser?
7 years, 6 months ago (2013-05-28 06:33:54 UTC) #3
Nils Barth (inactive)
On 2013/05/28 06:32:33, abarth wrote: > Can we remove the use of the preprocessor from ...
7 years, 6 months ago (2013-05-28 06:35:24 UTC) #4
abarth-chromium
Makes sense. :)
7 years, 6 months ago (2013-05-28 06:40:23 UTC) #5
Nils Barth (inactive)
On 2013/05/28 06:33:54, abarth wrote: > How does the performance of the new parser compare ...
7 years, 6 months ago (2013-05-28 07:00:17 UTC) #6
abarth-chromium
That sounds great. :)
7 years, 6 months ago (2013-05-28 07:08:46 UTC) #7
haraken
Great work! I'm happy to review the details of the patch once high-level issues are ...
7 years, 6 months ago (2013-05-28 07:21:33 UTC) #8
haraken
In addition, I'm OK with landing the lexer and the parser for all IDL files ...
7 years, 6 months ago (2013-05-28 07:23:18 UTC) #9
Nils Barth (inactive)
I was thinking of moving the incrementalism one level up, and doing IR incrementally as ...
7 years, 6 months ago (2013-05-28 08:32:19 UTC) #10
Nils Barth (inactive)
Agreed re: landing lexer and parser together: other than the actions (which are a bit ...
7 years, 6 months ago (2013-05-28 08:39:56 UTC) #11
haraken
Basically I don't want to introduce unnecessary complexity. (e.g. I don't want to consider IR-level ...
7 years, 6 months ago (2013-05-28 09:02:46 UTC) #12
Nils Barth (inactive)
OIC -- what you're suggesting is the other way around, so we start work on ...
7 years, 6 months ago (2013-05-28 11:31:31 UTC) #13
dominicc (has gone to gerrit)
I have made some comments. I believe the same comments are applicable in multiple places ...
7 years, 6 months ago (2013-06-26 04:20:53 UTC) #14
Nils Barth (inactive)
Thanks for feedback; will fix comments (and other concerns) and ping when done. https://codereview.chromium.org/15801003/diff/17001/Source/bindings/scripts/ir.py File ...
7 years, 6 months ago (2013-06-26 04:43:37 UTC) #15
Nils Barth (inactive)
Hi haraken, Here's the parser rewrite CL! It's a bit long, so I've given an ...
7 years, 5 months ago (2013-07-16 08:59:02 UTC) #16
haraken
The overall structure looks OK. Exciting CL! Let me take a close look later (or ...
7 years, 5 months ago (2013-07-16 09:10:31 UTC) #17
haraken
This is a great patch!! The overall structure looks good. Below comments are just minor ...
7 years, 5 months ago (2013-07-16 14:17:51 UTC) #18
haraken
Comment part 2: https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_definitions.py File Source/bindings/scripts/idl_definitions.py (right): https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_definitions.py#newcode31 Source/bindings/scripts/idl_definitions.py:31: Also JSON export, using legacy Perl ...
7 years, 5 months ago (2013-07-17 02:44:48 UTC) #19
haraken
Comment part 3. That's it from me. https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_definitions.py File Source/bindings/scripts/idl_definitions.py (right): https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_definitions.py#newcode51 Source/bindings/scripts/idl_definitions.py:51: __metaclass__ = ...
7 years, 5 months ago (2013-07-17 05:43:10 UTC) #20
Nils Barth (inactive)
Thanks for the thoughtful reviews and kind words! Here are the “minor replies” (yup, done, ...
7 years, 5 months ago (2013-07-17 12:05:08 UTC) #21
Nils Barth (inactive)
(Trailing commas?) https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/blink_idl_parser.py File Source/bindings/scripts/blink_idl_parser.py (right): https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/blink_idl_parser.py#newcode255 Source/bindings/scripts/blink_idl_parser.py:255: # [b50] Allow optional trailing comma On ...
7 years, 5 months ago (2013-07-17 12:07:10 UTC) #22
Nils Barth (inactive)
(Python module path.) https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/blink_idl_lexer.py File Source/bindings/scripts/blink_idl_lexer.py (right): https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/blink_idl_lexer.py#newcode59 Source/bindings/scripts/blink_idl_lexer.py:59: sys.path.append(tools_dir) On 2013/07/16 14:17:51, haraken wrote: ...
7 years, 5 months ago (2013-07-17 12:09:41 UTC) #23
Nils Barth (inactive)
(When to do Extended Attribute validation?) https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_validator.py File Source/bindings/scripts/idl_validator.py (right): https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_validator.py#newcode78 Source/bindings/scripts/idl_validator.py:78: # FIXME: this ...
7 years, 5 months ago (2013-07-17 12:11:01 UTC) #24
Nils Barth (inactive)
(Remove JSON once Perl gone.) https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_definitions.py File Source/bindings/scripts/idl_definitions.py (right): https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_definitions.py#newcode31 Source/bindings/scripts/idl_definitions.py:31: Also JSON export, using ...
7 years, 5 months ago (2013-07-17 12:13:45 UTC) #25
Nils Barth (inactive)
(Object construction design discussion.) https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_definitions.py File Source/bindings/scripts/idl_definitions.py (right): https://codereview.chromium.org/15801003/diff/27001/Source/bindings/scripts/idl_definitions.py#newcode94 Source/bindings/scripts/idl_definitions.py:94: def __init__(self, callback_functions=None, enumerations=None, exceptions=None, ...
7 years, 5 months ago (2013-07-17 12:17:01 UTC) #26
Nils Barth (inactive)
BTW, that's it for my replies and revisions for this round. A bunch of clarifications, ...
7 years, 5 months ago (2013-07-17 12:19:11 UTC) #27
haraken
Thanks for all the detailed replies! All make sense to me with some nits below. ...
7 years, 5 months ago (2013-07-21 14:31:49 UTC) #28
haraken
LGTM. Below are final comments. I'm doing a Blink gardening til Thu, so feel free ...
7 years, 5 months ago (2013-07-22 01:50:22 UTC) #29
Nils Barth (inactive)
Thanks for thorough comments; I've addressed and have posted a hopefully final CL. Will do ...
7 years, 5 months ago (2013-07-22 06:32:00 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nbarth@chromium.org/15801003/60001
7 years, 5 months ago (2013-07-22 06:42:52 UTC) #31
commit-bot: I haz the power
Change committed as 154633
7 years, 5 months ago (2013-07-22 08:48:57 UTC) #32
haraken
You did!
7 years, 5 months ago (2013-07-22 08:49:27 UTC) #33
abarth-chromium
https://chromiumcodereview.appspot.com/15801003/diff/60001/Source/bindings/derived_sources.gyp File Source/bindings/derived_sources.gyp (right): https://chromiumcodereview.appspot.com/15801003/diff/60001/Source/bindings/derived_sources.gyp#newcode265 Source/bindings/derived_sources.gyp:265: '../../../../tools/idl_parser/idl_parser.py', Consider using <(DEPTH) to find the top-level directory.
7 years, 5 months ago (2013-07-22 17:57:53 UTC) #34
Nils Barth (inactive)
7 years, 5 months ago (2013-07-23 09:04:06 UTC) #35
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/15801003/diff/60001/Source/bindings/de...
File Source/bindings/derived_sources.gyp (right):

https://chromiumcodereview.appspot.com/15801003/diff/60001/Source/bindings/de...
Source/bindings/derived_sources.gyp:265:
'../../../../tools/idl_parser/idl_parser.py',
On 2013/07/22 17:57:54, abarth wrote:
> Consider using <(DEPTH) to find the top-level directory.

Thanks, that's much better!
Posted CL fixing this:
Issue 19476005: Use <(DEPTH) in derived_sources.gyp for saner paths
https://codereview.chromium.org/19476005/

Powered by Google App Engine
This is Rietveld 408576698