]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Add Parser for Rust front-end pt.1
authorJoel Phillips <simplytheother@gmail.com>
Fri, 21 Oct 2022 11:39:04 +0000 (13:39 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 13 Dec 2022 13:00:04 +0000 (14:00 +0100)
commit35e4f3b4af4c4e9a883b40603199eea09f9cd9f0
treeb2de99d8f36f78cab0a30ba4fc12ae1b558ea2cc
parent18f6990f842d0bdcb2cf9541ca98d67b414d5802
gccrs: Add Parser for Rust front-end pt.1

This is a Pratt-style parser for Rust that implements all of the AST. The
rust-parser-impl.h is the implementation of the parser as a template,
allowing it to be given ManagedTokenSource and avoid virtual calls. The
downside is it takes time to compile when used.

see: https://en.wikipedia.org/wiki/Operator-precedence_parser#Pratt_parsing

This patch contains the first half of the templated parser, so as to not
lose patches in the mailing list archives.

gcc/rust/
* parse/rust-cfg-parser.cc: New.
* parse/rust-cfg-parser.h: New.
* parse/rust-parse-impl.h: New.
* parse/rust-parse.cc: New.
* parse/rust-parse.h: New.

Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Signed-off-by: Joel Phillips <simplytheother@gmail.com>
gcc/rust/parse/rust-cfg-parser.cc [new file with mode: 0644]
gcc/rust/parse/rust-cfg-parser.h [new file with mode: 0644]
gcc/rust/parse/rust-parse-impl.h [new file with mode: 0644]
gcc/rust/parse/rust-parse.cc [new file with mode: 0644]
gcc/rust/parse/rust-parse.h [new file with mode: 0644]