Skip to content

Commit

Permalink
0.9.503
Browse files Browse the repository at this point in the history
- General fixes
  • Loading branch information
RobbyV2 committed Nov 27, 2024
1 parent 4ef4039 commit 8140924
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "fplc"
version = "0.9.502"
version = "0.9.503"
edition = "2021"
description = "A pseudolang interpreter written in Rust"
repository = "https://github.com/PseudoLang-Software-Foundation/Pseudolang"
Expand Down
5 changes: 2 additions & 3 deletions build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ set -e
chmod +x build_release.sh

mkdir -p release/installer
mkdir -p release/wasm
mkdir -p release/wasi
mkdir -p release/wasm/raw
mkdir -p release/wasm/bindgen

echo "Building native targets..."

Expand All @@ -25,13 +26,11 @@ rustup target add wasm32-unknown-unknown

echo "Building raw WASM..."
cargo build --release --target wasm32-unknown-unknown --features wasm
mkdir -p release/wasm/raw
cp target/wasm32-unknown-unknown/release/fplc.wasm release/wasm/raw/

echo "Building WASM with bindgen..."
if command -v wasm-pack >/dev/null 2>&1; then
wasm-pack build --target web --release -- --features "wasm bindgen"
mkdir -p release/wasm/bindgen
cp pkg/* release/wasm/bindgen/
else
echo "wasm-pack not found, skipping bindgen WASM build"
Expand Down
4 changes: 2 additions & 2 deletions installer/pseudolang.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

!define MUI_ICON "Pseudolang-Logo.ico"

Name "PseudoLang Installer v0.9.502"
Name "PseudoLang Installer v0.9.503"
InstallDir "$PROGRAMFILES\PseudoLang\"
OutFile "../release/installer/pseudolang-setup-x64.exe"
BrandingText "(c) 2024 PseudoLang Software Foundation"
Expand Down Expand Up @@ -33,7 +33,7 @@ Section ""
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$INSTDIR;$R0"

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayName" "Pseudolang"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayVersion" "0.9.502"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayVersion" "0.9.503"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "Publisher" "Pseudolang Software Foundation"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayIcon" "$INSTDIR\Pseudolang-Logo.ico"

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div align="center">
<p>
<img src="https://github.com/PseudoLang-Software-Foundation/Pseudolang/actions/workflows/build.yml/badge.svg" alt="Build and Test Pseudolang">
<img src="https://img.shields.io/badge/Version-0.9.502-green" alt="Version">
<img src="https://img.shields.io/badge/Version-0.9.503-green" alt="Version">
<a href="https://nightly.link/PseudoLang-Software-Foundation/Pseudolang/workflows/build/main"><img src="https://img.shields.io/badge/Nightly-Releases-purple" alt="Nightly Releases"></a>
</p>
</div>
Expand Down
32 changes: 30 additions & 2 deletions src/wasm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#[cfg(all(target_arch = "wasm32", not(feature = "wasi")))]
use crate::core::execute_code;
#[cfg(all(target_arch = "wasm32", not(feature = "wasi")))]
use std::fmt::Write;

#[cfg(all(target_arch = "wasm32", not(feature = "wasi")))]
#[no_mangle]
Expand All @@ -9,7 +11,7 @@ pub extern "C" fn run_pseudolang_raw(ptr: *const u8, len: usize, debug: bool) ->
std::str::from_utf8_unchecked(slice)
};

match execute_code(input, debug, true) {
match run_with_debug(input, debug) {
Ok(output) => {
let bytes = output.into_bytes();
let ptr = bytes.as_ptr() as u64;
Expand All @@ -28,7 +30,33 @@ use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn run_pseudolang(input: &str, debug: bool) -> Result<String, JsValue> {
console_error_panic_hook::set_once();
execute_code(input, debug, true).map_err(|e| JsValue::from_str(&e))
run_with_debug(input, debug).map_err(|e| JsValue::from_str(&e))
}

#[cfg(all(target_arch = "wasm32", not(feature = "wasi")))]
fn run_with_debug(input: &str, debug: bool) -> Result<String, String> {
let mut output = String::new();
let mut lexer = crate::lexer::Lexer::new(input);
let tokens = lexer.tokenize();

if debug {
writeln!(output, "\n=== Lexer Output ===").unwrap();
writeln!(output, "Tokens: {:?}", tokens).unwrap();
writeln!(output, "\n=== Parser Starting ===").unwrap();
}

let ast = crate::parser::parse(tokens, false)?;

if debug {
writeln!(output, "\n=== Parser Output ===").unwrap();
writeln!(output, "AST: {:#?}", ast).unwrap();
writeln!(output, "\n=== Starting Execution ===").unwrap();
}

let program_output = crate::interpreter::run(ast)?;
writeln!(output, "{}", program_output).unwrap();

Ok(output)
}

#[cfg(all(target_arch = "wasm32", not(feature = "wasi")))]
Expand Down
2 changes: 1 addition & 1 deletion wapm.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[package]
name = "pseudolang/fplc"
version = "0.9.502"
version = "0.9.503"
description = "A pseudolang interpreter written in Rust"
license = "MIT"
readme = "readme.md"
Expand Down

0 comments on commit 8140924

Please sign in to comment.