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

chore: remove dbg! calls #18

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ With this project I'm attempting to create a lightweight PHP interpreter built u
It's currently in its early stages and is meant for experimental and educational purposes.

## Try it out
I've deployed the REPL to the web using WebAssembly (see the ```wasm``` directory)

I've deployed the REPL to the web using WebAssembly (see the `wasm` directory).
A GitHub Action is used to build and deploy it to S3 on every push to the `main` branch.

You can find it [here](https://php-rs.zakfarmer.com).

## Features

- Basic arithmetic operations
- Conditional operators / boolean expressions
- First-class functions
- Variable assignment & scopes
- WASM binary

Expect this list to grow 😁

Expand All @@ -35,11 +40,13 @@ cargo run
```

To run the testsuite:

```bash
cargo test
```

## Credits

The design of the project was heavily influenced by Thorsten Ball's "Writing an Interpreter in Go" and "Writing a Compiler in Go", of course adapted to Rust.
100% recommend reading both as they're great books if you're interested in language fundamentals.

Expand Down
2 changes: 0 additions & 2 deletions compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ impl Compiler {
Expression::Identifier(identifier) => {
let symbol = self.symbol_table.resolve(&identifier.value);

dbg!(&symbol);

match symbol {
Some(symbol) => {
self.emit(
Expand Down
7 changes: 1 addition & 6 deletions vm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
borrow::{Borrow, BorrowMut},
rc::Rc,
};
use std::{borrow::Borrow, rc::Rc};

use anyhow::Error;
use byteorder::{BigEndian, ByteOrder};
Expand Down Expand Up @@ -99,8 +96,6 @@ impl Vm {

let opcode = Opcode::from(op);

dbg!(opcode);

match opcode {
Opcode::OpJump => {
let jump_position = BigEndian::read_u16(
Expand Down
8 changes: 1 addition & 7 deletions vm/tests/vm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ use anyhow::Error;
use compiler::Compiler;
use lexer::Lexer;
use object::Object;
use parser::{
ast::{BlockStatement, Node},
Parser,
};
use parser::{ast::Node, Parser};
use vm::Vm;

struct VmTestCase {
Expand Down Expand Up @@ -415,9 +412,6 @@ fn test_variable_scopes() -> Result<(), Error> {

// TODO: remove duplication and extract helper function for use in multiple tests
fn assert_constants(expected: &Vec<Object>, actual: &Vec<Rc<Object>>) {
dbg!(expected);
dbg!(actual);

assert_eq!(expected.len(), actual.len());
for (exp, b_got) in expected.iter().zip(actual) {
let got = b_got.borrow();
Expand Down
1 change: 0 additions & 1 deletion wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use object::Object;
use parser::{ast::Node, Parser};
use vm::{Vm, GLOBALS_SIZE};
use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
use web_sys::console;

#[cfg(feature = "wee_alloc")]
#[global_allocator]
Expand Down