Skip to content

Instantly share code, notes, and snippets.

View coffeebe4code's full-sized avatar

Chris Clark coffeebe4code

View GitHub Profile
pub fn high_bin(&mut self) -> Option<Box<Expr<'a>>> {
let left = self.term()?;
let bin = self
.lexer
.collect_of_if(&[Token::Div, Token::Mul, Token::Mod]);
if let Some(x) = bin {
// TODO:: Error if expr is none
let right = self.term()?;
return some_expr!(BinOp, left, x.token, right);
}
@coffeebe4code
coffeebe4code / bnf.md
Last active May 12, 2022 02:06
My BNF so far
statement       => expression* | return ; // initially only expressions and a final return is supported (not sure how to represent it)
return          => "return" low_bin ";"? ;
expression      => assignment | reassignment; 

assignment      => ("const" | "mut") IDENTIFIER ( "=" ) low_bin ";"? ;
reassignment    => IDENTIFIER ( "=" | "/=" | "-=" | "+=" | "*=" | "&=" | "^=" | "|=" ) low_bin ";"? ;
low_bin         => high_bin ( ( "-" | "+") high_bin )* ;
high_bin        => TERMINAL ( ( "/" | "*" | "%" ) TERMINAL )* ;
au FileType rust set compiler=rs
@coffeebe4code
coffeebe4code / help.md
Last active September 26, 2021 01:02
help question

I have two units of code (featureA.c, featureA.h) (featureB.c, featureB.h). featureB has an include to featureA.h because it uses a function there, when i do this, everything works out.

gcc -Wall -O0 -std=c11 -g  -o test.exe test.o featureA.o featureB.o -lpthread

However, now I want to distribute my libraries. When I attempt to make an example project with.

gcc -Wall -O0 -std=c11 -g -o target/example.exe example/main.c lib/libfeatureA.a lib/libfeatureB.a -lpthread