aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.rs
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2021-09-14 00:19:40 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2021-09-14 00:19:40 +0200
commit9e6c0a92dbedb5b8801772802e2e5d2e56cb9bcf (patch)
tree96e798b847138a2edffadad02ef6ec74cfd8c739 /src/parser.rs
parent96e9dd5f4ae46b5705b8063a43bb8576e1e5b7b0 (diff)
downloadllvm-kaleidoscope-rs-9e6c0a92dbedb5b8801772802e2e5d2e56cb9bcf.tar.gz
llvm-kaleidoscope-rs-9e6c0a92dbedb5b8801772802e2e5d2e56cb9bcf.zip
ch3: added LLVM IR code genchapter3
- Added safe wrapper around LLVM C API - Added codegen module to emit LLVM IR for the AST - Update the main repl loop to codegen LLVM IR
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 63f5a77..af69a87 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -19,15 +19,16 @@ pub enum ExprAST {
/// which captures its name, and its argument names (thus implicitly the number
/// of arguments the function takes).
#[derive(Debug, PartialEq)]
-pub struct PrototypeAST(String, Vec<String>);
+pub struct PrototypeAST(pub String, pub Vec<String>);
/// FunctionAST - This class represents a function definition itself.
#[derive(Debug, PartialEq)]
-pub struct FunctionAST(PrototypeAST, ExprAST);
+pub struct FunctionAST(pub PrototypeAST, pub ExprAST);
/// Parse result with String as Error type (to be compliant with tutorial).
type ParseResult<T> = Result<T, String>;
+/// Parser for the `kaleidoscope` language.
pub struct Parser<I>
where
I: Iterator<Item = char>,