Skip to content

Commit

Permalink
feat(builtins): Symbols as builtins (PLC-lang#1012)
Browse files Browse the repository at this point in the history
* variadic add builtin function
* index on builtin-arithmetics: 
* move arith func correctness tests in own folder
* add tests, fix sized variadic test naming conflict
* - adds comparison operators as builtin-functions.
- annotates call-statements with `ReplacementAst` statements
- temporary name-conflict fix for string-comparison
overloads

* fix comparison function logic.
(GT(a, b, c) == a > b && b > c && c > d)
add test to make sure AST is the same whether using symbols or calls

* fix function overloads for string comparison
* refactor part of `visit_call_statement`
moved to its own function so it can be redirected to
* refactor builtin annotations to reduce
necessary ast-replacement checks
during codegen.
fix type-hints for nested binary-expr. with builtin-calls
* fix st-header formatting
* fix string header signature mismatch
* param count validation
  • Loading branch information
mhasel authored Dec 1, 2023
1 parent 5615d80 commit cf34cf6
Show file tree
Hide file tree
Showing 56 changed files with 3,462 additions and 842 deletions.
38 changes: 24 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions compiler/plc_driver/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,14 @@ pub fn compile_and_run<T, U, S: Compilable>(source: S, params: &mut T) -> U {
module.print_to_stderr();
module.run::<T, U>("main", params)
}

///
/// A Convenience method to compile and then run the given source
/// without external parameters
///
pub fn compile_and_run_no_params<U, S: Compilable>(source: S) -> U {
let context: CodegenContext = CodegenContext::create();
let module = compile(&context, source);
module.print_to_stderr();
module.run_no_param::<U>("main")
}
Loading

0 comments on commit cf34cf6

Please sign in to comment.