From 209f93275c2df0caad3d2283e9c98d926ea21daf Mon Sep 17 00:00:00 2001 From: Ethan Uppal <113849268+ethanuppal@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:26:26 -0400 Subject: [PATCH 1/2] Use result in builder creation --- crates/calyx-builder/src/lib.rs | 9 ++++----- pulsar-backend/src/calyx.rs | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/calyx-builder/src/lib.rs b/crates/calyx-builder/src/lib.rs index 6ef4cba..33da583 100644 --- a/crates/calyx-builder/src/lib.rs +++ b/crates/calyx-builder/src/lib.rs @@ -654,13 +654,12 @@ impl CalyxBuilder { pub fn new( prelude: Option, lib_path: PathBuf, entrypoint: Option, cell_name_prefix: String - ) -> Self { + ) -> calyx_utils::CalyxResult { assert!(!cell_name_prefix.is_empty()); // A workspace is created for the sole purpose of obtaining standard // library definitions -- it is immediately turned into a context. - let ws = - calyx_frontend::Workspace::construct(&prelude, &lib_path).unwrap(); + let ws = calyx_frontend::Workspace::construct(&prelude, &lib_path)?; let ctx = calyx_ir::Context { components: vec![], lib: ws.lib, @@ -670,11 +669,11 @@ impl CalyxBuilder { metadata: None }; - Self { + Ok(Self { ctx, sigs: HashMap::new(), cell_name_prefix - } + }) } ///
This builder cannot be used.
diff --git a/pulsar-backend/src/calyx.rs b/pulsar-backend/src/calyx.rs index e6e7d17..dfaf3f9 100644 --- a/pulsar-backend/src/calyx.rs +++ b/pulsar-backend/src/calyx.rs @@ -432,6 +432,7 @@ impl PulsarBackend for CalyxBackend { None, "_".into() ) + .expect("Invalid library path") } } From af22dd0c0114912ee7fe45db9111343d8d13bac8 Mon Sep 17 00:00:00 2001 From: Ethan Uppal <113849268+ethanuppal@users.noreply.github.com> Date: Fri, 21 Jun 2024 00:35:55 -0400 Subject: [PATCH 2/2] Update README --- LICENSE | 3 +++ README.md | 6 +++--- pulsar-frontend/src/syntax.ebnf | 24 ------------------------ 3 files changed, 6 insertions(+), 27 deletions(-) delete mode 100644 pulsar-frontend/src/syntax.ebnf diff --git a/LICENSE b/LICENSE index 60de636..07a726c 100644 --- a/LICENSE +++ b/LICENSE @@ -1 +1,4 @@ Copyright (C) 2024 Ethan Uppal. All rights reserved. + +I do not intend this code to be useful beyond serving a pedagogical purpose for myself and as a record of my work. +If not otherwise stated in full terms, this license applies to all source files under my copyright in this repository. diff --git a/README.md b/README.md index 6366a9a..155b6b1 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ ![CI](https://github.com/ethanuppal/pulsar/actions/workflows/ci.yaml/badge.svg) [![CodeFactor](https://www.codefactor.io/repository/github/ethanuppal/pulsar/badge)](https://www.codefactor.io/repository/github/ethanuppal/pulsar) -Pulsar is a hobby PL, which, for fun, I am implementing both software and hardware backends. -Currently, I am working toward implementing such a hardware backend via the [calyx] infrastructure. +Pulsar is a programming language for building hardware accelerators. +In what exactly? I'm not sure yet. -The WIP syntax is a very blatant clone of Swift's with some modifications. +As of right now, I'm using Swift's syntax for that nice syntax highlighting: ```swift func increment(x: Int) -> Int { return x + 1 diff --git a/pulsar-frontend/src/syntax.ebnf b/pulsar-frontend/src/syntax.ebnf deleted file mode 100644 index 883a9f8..0000000 --- a/pulsar-frontend/src/syntax.ebnf +++ /dev/null @@ -1,24 +0,0 @@ -literal = ? literal value ? - -prefix-op = ? prefix operator ? - -infix-op = ? infix operator ? - -primary-expr - = literal - | "(", expr, ")"; - -prefix-unary-expr - = prefix-op, expr; - -infix-binary-expr - = expr, infix-op, expr; - -postfix-binary-expr - = expr, "[", expr, "]"; - -expr - = primary-expr - | prefix-unary-expr - | infix-binary-expr - | postfix-binary-expr;