1
1
Oxc Parser for JavaScript and TypeScript
2
2
3
3
Oxc's [ ` Parser ` ] has full support for
4
+
4
5
- The latest stable ECMAScript syntax
5
6
- TypeScript
6
7
- JSX and TSX
@@ -16,16 +17,18 @@ let parser_return = Parser::new(&allocator, &source_text, source_type).parse();
16
17
```
17
18
18
19
# Abstract Syntax Tree (AST)
20
+
19
21
Oxc's AST is located in a separate [ ` oxc_ast ` ] crate. You can find type definitions for AST
20
22
nodes [ here] [ `oxc_ast::ast` ] .
21
23
22
24
# Performance
23
25
24
26
The following optimization techniques are used:
25
- * AST is allocated in a memory arena ([ bumpalo] ( https://docs.rs/bumpalo ) ) for fast AST drop
26
- * [ ` oxc_span::Span ` ] offsets uses ` u32 ` instead of ` usize `
27
- * Scope binding, symbol resolution and complicated syntax errors are not done in the parser,
28
- they are delegated to the [ semantic analyzer] ( https://docs.rs/oxc_semantic )
27
+
28
+ - AST is allocated in a memory arena ([ bumpalo] ( https://docs.rs/bumpalo ) ) for fast AST drop
29
+ - [ ` oxc_span::Span ` ] offsets uses ` u32 ` instead of ` usize `
30
+ - Scope binding, symbol resolution and complicated syntax errors are not done in the parser,
31
+ they are delegated to the [ semantic analyzer] ( https://docs.rs/oxc_semantic )
29
32
30
33
<div class =" warning " >
31
34
Because [ ` oxc_span::Span ` ] uses ` u32 ` instead of ` usize ` , Oxc can only parse files up
@@ -94,6 +97,7 @@ fn main() -> Result<(), String> {
94
97
```
95
98
96
99
### Parsing TSX
100
+
97
101
``` rust
98
102
use oxc_allocator :: Allocator ;
99
103
use oxc_parser :: {Parser , ParserReturn };
0 commit comments