about summary refs log tree commit diff
path: root/users/glittershark/achilles/src/parser/type_.rs
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-03-20T00·46-0400
committerglittershark <grfn@gws.fyi>2021-03-20T20·20+0000
commit2c838ab845bc54c5ef6cb0561332c84f34249368 (patch)
treec54c95ebc7f503a1db255566b3e25494bbaa28b3 /users/glittershark/achilles/src/parser/type_.rs
parentfec6595d211e7e3ea616d8335fe5d143a4a7507d (diff)
feat(gs/achilles): Implement extern decls, for glibc functions r/2293
Implement extern decls, which codegen to LLVM as forward-declared
functions, and use these as a hook into calling glibc functions.

We can print to the terminal now! The integration tests can test this
now.

Change-Id: I70af4546b417b888ad9fbb18798db240f77f4e71
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2614
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'users/glittershark/achilles/src/parser/type_.rs')
-rw-r--r--users/glittershark/achilles/src/parser/type_.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/users/glittershark/achilles/src/parser/type_.rs b/users/glittershark/achilles/src/parser/type_.rs
index c90ceda4d7..1e6e380bb8 100644
--- a/users/glittershark/achilles/src/parser/type_.rs
+++ b/users/glittershark/achilles/src/parser/type_.rs
@@ -4,7 +4,7 @@ use nom::{alt, delimited, do_parse, map, named, opt, separated_list0, tag, termi
 use super::ident;
 use crate::ast::{FunctionType, Type};
 
-named!(function_type(&str) -> Type, do_parse!(
+named!(pub function_type(&str) -> FunctionType, do_parse!(
     tag!("fn")
         >> multispace1
         >> args: map!(opt!(terminated!(separated_list0!(
@@ -18,10 +18,10 @@ named!(function_type(&str) -> Type, do_parse!(
         >> tag!("->")
         >> multispace1
         >> ret: type_
-        >> (Type::Function(FunctionType {
+        >> (FunctionType {
             args,
             ret: Box::new(ret)
-        }))
+        })
 ));
 
 named!(pub type_(&str) -> Type, alt!(
@@ -29,7 +29,7 @@ named!(pub type_(&str) -> Type, alt!(
     tag!("float") => { |_| Type::Float } |
     tag!("bool") => { |_| Type::Bool } |
     tag!("cstring") => { |_| Type::CString } |
-    function_type |
+    function_type => { |ft| Type::Function(ft) }|
     ident => { |id| Type::Var(id) } |
     delimited!(
         tuple!(tag!("("), multispace0),