diff --git a/README.md b/README.md index c191250..5467b35 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,18 @@ --- +#### Usage + +```rust +use php_parser_rs::*; + +let mut lexer = Lexer::new(None); +let tokens = lexer.tokenize(&source_code[..]).unwrap(); + +let mut parser = Parser::new(None); +let ast = parser.parse(tokens).unwrap(); +``` + #### Contributing All contributions to this repository are welcome. It's the perfect project for Rust beginners since we don't use many of Rust's complex features and the core concepts in the parser are purposely simple. diff --git a/src/README.md b/src/README.md deleted file mode 100644 index d909439..0000000 --- a/src/README.md +++ /dev/null @@ -1,28 +0,0 @@ -
- A handwritten recursive-descent parser for PHP code. -
- ---- - -#### Overview - -The parser produces an abstract syntax tree containing `Statement` and `Expression` types describing the PHP code provided. - -#### Usage - -```rust -use trunk_lexer::*; -use trunk_parser::*; - -let mut lexer = Lexer::new(None); -let tokens = lexer.tokenize(&source_code[..]).unwrap(); - -let mut parser = Parser::new(None); -let ast = parser.parse(tokens).unwrap(); -``` - -The resulting `ast` is a `Vec