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

multiple statements in single line evaluation #17

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

Pavel-Durov
Copy link
Contributor

@Pavel-Durov Pavel-Durov commented Mar 13, 2023

  • evaluating multiple statements separated by ';' char
    example:
$ RUST_LOG=debug cargo run 'let _a = 2; println(_a + 3);'
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/yaiwr 'let _a = 2; println(_a + 3);'`
[2023-03-13T11:57:49Z DEBUG yaiwr] cli args ["let _a = 2; println(_a + 3);"]
[2023-03-13T11:57:49Z DEBUG yaiwr] statement: "let _a = 2;"
[2023-03-13T11:57:49Z DEBUG yaiwr] AST: Assign { id: "_a", rhs: Number { value: 2 } }
[2023-03-13T11:57:49Z DEBUG yaiwr] Bytecode: [Push { value: 2 }, Assign { id: "_a" }]
[2023-03-13T11:57:49Z DEBUG yaiwr] statement: " println(_a + 3);"
[2023-03-13T11:57:49Z DEBUG yaiwr] AST: PrintLn { rhs: Add { lhs: ID { value: "_a" }, rhs: Number { value: 3 } } }
[2023-03-13T11:57:49Z DEBUG yaiwr] Bytecode: [Load { id: "_a" }, Push { value: 3 }, Add, PrintLn]
5

@Pavel-Durov Pavel-Durov changed the title single line program with multiple statements eval multiple statements evaluation Mar 13, 2023
@Pavel-Durov Pavel-Durov self-assigned this Mar 14, 2023
@Pavel-Durov Pavel-Durov force-pushed the semicolumn-separated-statements branch from 09e9e57 to c8204f5 Compare March 14, 2023 17:42
@Pavel-Durov Pavel-Durov changed the title multiple statements evaluation DRAFT - WIP - multiple statements evaluation Mar 14, 2023
@Pavel-Durov Pavel-Durov force-pushed the semicolumn-separated-statements branch from c8204f5 to fee4f6d Compare March 15, 2023 09:34
@Pavel-Durov Pavel-Durov changed the title DRAFT - WIP - multiple statements evaluation multiple statements evaluation Mar 15, 2023
@Pavel-Durov
Copy link
Contributor Author

bors try

bors bot added a commit that referenced this pull request Mar 15, 2023
@Pavel-Durov Pavel-Durov assigned vext01 and unassigned Pavel-Durov Mar 15, 2023
@Pavel-Durov Pavel-Durov changed the title multiple statements evaluation multiple statements in single line evaluation Mar 15, 2023
@Pavel-Durov Pavel-Durov force-pushed the semicolumn-separated-statements branch from fee4f6d to c7954b7 Compare March 15, 2023 09:36
@bors
Copy link
Contributor

bors bot commented Mar 15, 2023

try

Build succeeded:

src/main.rs Outdated Show resolved Hide resolved
Ok(result) => Ok(result),
Err(err) => Err(err),
fn eval_statement(input: &str, calc: &mut Calc) -> Option<u64> {
let statements: Vec<String> = input
Copy link
Member

Choose a reason for hiding this comment

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

This is much better. I didn't realise that we were parsing line-by-line.

src/main.rs Outdated Show resolved Hide resolved
@vext01
Copy link
Member

vext01 commented Mar 16, 2023

Please squash.

@Pavel-Durov Pavel-Durov force-pushed the semicolumn-separated-statements branch from d8bb677 to 36e3d07 Compare March 16, 2023 09:50
@Pavel-Durov
Copy link
Contributor Author

squashed 👉 36e3d07

@vext01
Copy link
Member

vext01 commented Mar 16, 2023

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 16, 2023

Build succeeded:

@bors bors bot merged commit 903c0e1 into softdevteam:main Mar 16, 2023
@Pavel-Durov Pavel-Durov mentioned this pull request Mar 16, 2023
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