1
1
# Parser and pretty-printer for Rust [ ![ Build Status] [ 4 ]] [ 5 ] [ ![ Windows build status] [ 7 ]] [ 8 ]
2
2
3
3
` language-rust ` aspires to efficiently and accurately parse and pretty-print the [ Rust language] [ 0 ] .
4
- The underlying AST structures are also intended to be as similar as possible to the AST ` rustc ` uses
5
- itself. When ` language-rust ` and ` rustc ` have diverging AST, the divergence should be detailed in
6
- the documentation.
4
+ The underlying AST structures are also intended to be as similar as possible to the ` libsyntax ` AST
5
+ ` rustc ` uses itself. When ` language-rust ` and ` rustc ` have diverging AST, the divergence should be
6
+ detailed in the documentation.
7
7
8
8
A typical use looks like:
9
9
10
10
``` haskell
11
11
>>> : set - XTypeApplications + t
12
12
>>> import Language.Rust. Syntax
13
- >>>
13
+
14
14
>>> -- Sample use of the parser
15
15
>>> import Language.Rust. Parser
16
16
>>> let inp = inputStreamFromString " fn main () { println!(\" Hello world!\" ); }"
17
17
inp :: InputStream
18
18
>>> Right sourceFile = parse @ (SourceFile Span ) inp
19
19
sourceFile :: SourceFile Span
20
- >>>
20
+
21
21
>>> -- Sample use of the pretty-printer
22
22
>>> import Language.Rust. Pretty
23
23
>>> pretty sourceFile
@@ -31,7 +31,7 @@ it :: Doc b
31
31
32
32
### Cabal
33
33
34
- With Cabal and GHC , you should only need to run
34
+ With Cabal and GHC , run
35
35
36
36
cabal install happy -- constraint 'happy >= 1.19.8'
37
37
cabal install alex
@@ -40,7 +40,7 @@ With Cabal and GHC, you should only need to run
40
40
41
41
### Stack
42
42
43
- With the [Stack ][1 ] tool installed, you should only need to run
43
+ With the [Stack ][1 ] tool installed, run
44
44
45
45
stack init
46
46
stack build
0 commit comments