You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -59,15 +61,15 @@ foreach ($astNode->getDescendantNodes() as $descendant) {
59
61
}
60
62
```
61
63
62
-
> Note: [the API](docs/ApiDocumentation.md) is not yet finalized, so please file issues let us know what functionality you want exposed,
64
+
> Note: [the API](docs/ApiDocumentation.md) is not yet finalized, so please file issues let us know what functionality you want exposed,
63
65
and we'll see what we can do! Also please file any bugs with unexpected behavior in the parse tree. We're still
64
66
in our early stages, and any feedback you have is much appreciated :smiley:.
65
67
66
68
## Design Goals
67
69
* Error tolerant design - in IDE scenarios, code is, by definition, incomplete. In the case that invalid code is entered, the
68
-
parser should still be able to recover and produce a valid + complete tree, as well as relevant diagnostics.
70
+
parser should still be able to recover and produce a valid + complete tree, as well as relevant diagnostics.
69
71
* Fast and lightweight (should be able to parse several MB of source code per second,
70
-
to leave room for other features).
72
+
to leave room for other features).
71
73
* Memory-efficient data structures
72
74
* Allow for incremental parsing in the future
73
75
* Adheres to [PHP language spec](https://github.com/php/php-langspec),
@@ -83,34 +85,34 @@ so each language server operation should be < 50 ms to leave room for all the
83
85
confusing, really fast, so readability and debug-ability is high priority.
84
86
* Testable - the parser should produce provably valid parse trees. We achieve this by defining and continuously testing
85
87
a set of invariants about the tree.
86
-
* Friendly and descriptive API to make it easy for others to build on.
88
+
* Friendly and descriptive API to make it easy for others to build on.
87
89
* Written in PHP - make it as easy as possible for the PHP community to consume and contribute.
88
90
89
91
## Current Status and Approach
90
92
To ensure a sufficient level of correctness at every step of the way, the
91
93
parser is being developed using the following incremental approach:
92
94
93
-
*[x]**Phase 1:** Write lexer that does not support PHP grammar, but supports EOF
95
+
*[x]**Phase 1:** Write lexer that does not support PHP grammar, but supports EOF
94
96
and Unknown tokens. Write tests for all invariants.
95
97
*[x]**Phase 2:** Support PHP lexical grammar, lots of tests
96
-
*[x]**Phase 3:** Write a parser that does not support PHP grammar, but produces tree of
98
+
*[x]**Phase 3:** Write a parser that does not support PHP grammar, but produces tree of
97
99
Error Nodes. Write tests for all invariants.
98
100
*[x]**Phase 4:** Support PHP syntactic grammar, lots of tests
99
101
*[ ]**Phase 5 (in progress :running:):** Real-world validation and optimization
100
102
*[ ]_**Correctness:**_ validate that there are no errors produced on sample codebases, benchmark against other parsers (investigate any instance of disagreement), fuzz-testing
101
103
*[ ]_**Performance:**_ profile, benchmark against large PHP applications
102
-
*[ ]**Phase 6:** Finalize API to make it as easy as possible for people to consume.
104
+
*[ ]**Phase 6:** Finalize API to make it as easy as possible for people to consume.
103
105
104
106
### Additional notes
105
107
A few of the PHP grammatical constructs (namely yield-expression, and template strings)
106
108
are not yet supported and there are also other miscellaneous bugs. However, because the parser is error-tolerant,
107
109
these errors are handled gracefully, and the resulting tree is otherwise complete. To get a more holistic sense for
108
-
where we are, you can run the "validation" test suite (see [Contributing Guidelines](Contributing.md) for more info
110
+
where we are, you can run the "validation" test suite (see [Contributing Guidelines](Contributing.md) for more info
109
111
on running tests). Or simply, take a look at the current [validation test results](https://travis-ci.org/Microsoft/tolerant-php-parser).
110
112
111
-
Even though we haven't yet begun the performance optimization stage, we have seen promising results so far,
112
-
and have plenty more room for improvement. See [How It Works](docs/HowItWorks.md) for details on our current
113
-
approach, and run the [Performance Tests](Contributing.md#running-performance-tests) on your
113
+
Even though we haven't yet begun the performance optimization stage, we have seen promising results so far,
114
+
and have plenty more room for improvement. See [How It Works](docs/HowItWorks.md) for details on our current
115
+
approach, and run the [Performance Tests](Contributing.md#running-performance-tests) on your
114
116
own machine to see for yourself.
115
117
116
118
## Learn more
@@ -119,7 +121,7 @@ own machine to see for yourself.
119
121
**:book:[Documentation](docs/GettingStarted.md#getting-started)** - learn how to reference the parser from your project, and how to perform
120
122
operations on the AST to answer questions about your code.
121
123
122
-
**:eyes:[Syntax Visualizer Tool](syntax-visualizer/client#php-parser-syntax-visualizer-tool)** - get a more tangible feel for the AST. Get creative - see if you can break it!
124
+
**:eyes:[Syntax Visualizer Tool](syntax-visualizer/client#php-parser-syntax-visualizer-tool)** - get a more tangible feel for the AST. Get creative - see if you can break it!
123
125
124
126
**:chart_with_upwards_trend:[Current Status and Approach](#current-status-and-approach)** - how much of the grammar is supported? Performance? Memory? API stability?
125
127
@@ -131,10 +133,10 @@ operations on the AST to answer questions about your code.
0 commit comments