Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating C and Python bindings for all functionality used by Repl. Refactoring Repl to call through Python by default #450

Merged
merged 34 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1a395b7
Initial draft of API-wide MeTTa Environment object, to replace the no…
luketpeterson Sep 23, 2023
00d62fc
Transitioning Environment config API to a "builder" style API
luketpeterson Sep 23, 2023
c05e12e
Updating C & Python runner init code to use Environment by default
luketpeterson Sep 23, 2023
95cd2ce
Adding C API for platform environment config
luketpeterson Sep 24, 2023
24a0d63
Exposing environment configuration as a Python API
luketpeterson Sep 24, 2023
6d9d06e
Oops forgot to git add file
luketpeterson Sep 24, 2023
adee13e
Exposing C Api for parsing into syntax nodes
luketpeterson Sep 24, 2023
fd3b6c1
Adding Python interface to SyntaxNode parsing
luketpeterson Sep 25, 2023
9906182
Adding C interface to incremental runner
luketpeterson Sep 26, 2023
1de9d45
Exposing incremental runner in Python API
luketpeterson Sep 26, 2023
a181df9
Adding pathway to access parse errors in C & Python APIs
luketpeterson Sep 27, 2023
6679de9
Refactoring the repl app to call through python for every MeTTa inter…
luketpeterson Oct 2, 2023
9c6dd2c
Getting rid of ctor, since we now have a top-level object from which …
luketpeterson Oct 2, 2023
b504aeb
Merge branch 'main' into repl
luketpeterson Oct 2, 2023
b80a23f
Fixing bug where logger wasn't initialized when platform environment …
luketpeterson Oct 3, 2023
586e2b2
Adding `try_init` so platform environment initialization can graceful…
luketpeterson Oct 4, 2023
3531f6f
Merge branch 'main' into repl
luketpeterson Oct 5, 2023
286c696
Merge branch 'main' into repl
luketpeterson Oct 5, 2023
dc15fc3
Extensive rework of Environment API, to permit multiple coexisting en…
luketpeterson Oct 6, 2023
19df80e
Merge branch 'main' into repl
luketpeterson Oct 9, 2023
457d757
Adding `atom_vec_from_list` to hyperonpy, in order to create an atom_…
luketpeterson Oct 11, 2023
2082e52
Merge branch 'main' into repl
luketpeterson Oct 12, 2023
3ac2582
Refactoring runner into process with a hook to insert a language-spec…
luketpeterson Oct 12, 2023
205b4d0
Converting `Atom.is_error()` in atoms.py into `atom_is_error()` in ba…
luketpeterson Oct 12, 2023
3be64f5
Moving Environment sub-module into runner
luketpeterson Oct 12, 2023
9029f66
Renaming "platform" environment to "common" environment
luketpeterson Oct 12, 2023
a3808f1
Updating the way parse errors are returned from the C & Python parse …
luketpeterson Oct 13, 2023
790ad1e
Adding back the ability to create a fully-initialized top-level runne…
luketpeterson Oct 17, 2023
8254d3f
Adding runner_eq() function to compare the runners referenced by runn…
luketpeterson Oct 17, 2023
d5253d7
Re-Adding side-band error accessor to parser, so parsing parse errors…
luketpeterson Oct 17, 2023
d649ba1
Fixing benchmarks and tests to compile with all the API changes
luketpeterson Oct 18, 2023
fe6c15d
one last fix so repl's "no_python" feature uses new API
luketpeterson Oct 18, 2023
f5cef9a
Merge branch 'main' into repl
luketpeterson Oct 19, 2023
f31df56
GitHub.com editor messed up indentation in last merge. Fixing.
luketpeterson Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions c/doc/mainpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ More complete documentation on the MeTTa language, type system, and the MeTTa st

This Interface includes the types and functions to instantiate a MeTTa interpreter and step through MeTTa code.

[//]: # (Platform Environment Interface)

@defgroup environment_group Platform Environment Interface
@brief Configuration and settings shared by MeTTa runners

This interface allows configuration of shared properties for MeTTa interpreters

[//]: # (Misc. Interfaces)

@defgroup misc_group Misc Interfaces
Expand Down
2 changes: 1 addition & 1 deletion c/src/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ impl atom_vec_t {
fn new() -> Self {
Vec::<Atom>::new().into()
}
fn as_slice(&self) -> &[Atom] {
pub(crate) fn as_slice(&self) -> &[Atom] {
unsafe{ core::slice::from_raw_parts(self.ptr.cast(), self.len) }
}
/// Converts a borrowed vec into an owned vec
Expand Down
13 changes: 0 additions & 13 deletions c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,3 @@ pub mod util;
pub mod atom;
pub mod space;
pub mod metta;

/// @brief Initializes the logger
/// @ingroup misc_group
/// @note This function should be called once, prior to any other calls to Hyperon C functions
///
//TODO: Is there a way we can get rid of this function in the external API?
// Discussion about alternative ways to init the logger here: https://github.com/trueagi-io/hyperon-experimental/pull/314
// and here: https://github.com/trueagi-io/hyperon-experimental/issues/146
#[no_mangle]
pub extern "C" fn init_logger() {
hyperon::common::init_logger(false);
}

Loading
Loading