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

Change parser to build syntax tree, which is used for syntax highlighting, add config.metta to repl #419

Merged
merged 26 commits into from
Sep 6, 2023

Conversation

luketpeterson
Copy link
Contributor

No description provided.

@luketpeterson
Copy link
Contributor Author

luketpeterson commented Sep 3, 2023

Also added runner interruptibility for both interactive and arg-invoked modes.

@luketpeterson
Copy link
Contributor Author

Interruptibility now goes all the way into the interpreter loop, not just the runner outer-loop

lib/src/metta/text.rs Outdated Show resolved Hide resolved
lib/src/metta/text.rs Show resolved Hide resolved
repl/src/interactive_helper.rs Show resolved Hide resolved
//Run the config.metta file
let repl_params = repl_params.borrow();
let config_metta_path = repl_params.config_metta_path();
new_shim.load_metta_module(config_metta_path.clone());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably makes sense in interactive mode but I believe doesn't make sense in script execution mode. At least now this configuration contains only highlighter settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want this config file to contain all the settings for both interactive and script-execution mode. However, there are currently only interactive settings because I don't see a way to do the string manipulation for import paths using MeTTa's current stdlib.

Is you point that running these setup statements is a waste of time if they don't matter for the execution mode? We could do something to separate them.

What do you think? A separate repl.metta file (runs only in interactive mode), in addition to the config.metta file (runs always)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think it intersects heavily with pragmas which was implemented by @Necr0x0Der , thus we need to think what we should keep or how we can merge these two ways of configuration. I don't like we have two different mechanisms to tune the execution. Keeping settings inside an atomspace looks more logical to me. But then we need to align pragma syntax to change these settings inside this atomspace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will wait for your discussion with Alexey.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have raised #425 to address this in future

repl/src/main.rs Outdated Show resolved Hide resolved
repl/src/main.rs Outdated Show resolved Hide resolved
repl/src/metta_shim.rs Outdated Show resolved Hide resolved
repl/src/metta_shim.rs Outdated Show resolved Hide resolved
@vsbogd
Copy link
Collaborator

vsbogd commented Sep 5, 2023

Looks like on my system repl cannot create the directory to put config file:

$ RUST_BACKTRACE=1 cargo run
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/config_params.rs:49:43

@luketpeterson
Copy link
Contributor Author

Looks like on my system repl cannot create the directory to put config file:

Hmmm. Is it a permissions issue?

I should definitely improve that error message!

@vsbogd
Copy link
Collaborator

vsbogd commented Sep 5, 2023

Is it a permissions issue?

No just <home>/.config directory doesn't contain metta directory, after I created it code works.

@vsbogd
Copy link
Collaborator

vsbogd commented Sep 5, 2023

Looks like 21708ca fixes it thanks!

…en to accept a newline and when to report syntax errors
Changing enter-key behavior when cursor isn't at the end
@vsbogd
Copy link
Collaborator

vsbogd commented Sep 6, 2023

Luke, I am happy with it, please feel free to merge it if you don't have any additions. Thank you!

@luketpeterson luketpeterson merged commit a285e35 into trueagi-io:main Sep 6, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants