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

updating ui #5

Merged
merged 1 commit into from
Jun 26, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/target
notes.txt
ui/git_backup
.gitignore
.gitignore
gg.ai
example.ai
32 changes: 9 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# [name]
# grad

This project implements a custom programming language `grad` and its compiler, written in Rust. The compiler follows a multi-stage process to transform source code into executable bytecode, which is then interpreted by a custom Virtual Machine (VM).

## Getting Started

Try the language in the [playground](grad.vercel.app).
Try the language in the [playground](https://grad.vercel.app).

### Example

```bash
cargo install grad
echo "let a = 10; print(a);" > example.rs
[name] run example.rs
echo "let a = 10; print(a);" > example.grad
grad run example.grad
```

## Table of Contents
Expand Down Expand Up @@ -190,6 +190,8 @@ Here's a simple program to demonstrate how it progresses through each stage of t
### Sample Program

```
print("Hello, world!");

let a = 4.0;
let b = 2**2;

Expand Down Expand Up @@ -263,26 +265,10 @@ Hello, world!

## Future Improvements

While this compiler implements core functionality, there are several areas for potential improvement:
While this compiler implements core functionality, there are several areas for potential improvements:

1. **Type System**: Implement a static type system with type inference for improved safety and performance.

2. **Optimization**: Add optimization passes to improve the generated bytecode's efficiency.

3. **Error Handling**: Enhance error reporting with more detailed messages and source code locations.

4. **Standard Library**: Develop a comprehensive standard library for common operations.

5. **Garbage Collection**: Implement a garbage collector for automatic memory management.

6. **Just-In-Time (JIT) Compilation**: Add a JIT compiler for improved runtime performance.

7. **Concurrency**: Implement language-level constructs for concurrent programming.

8. **Modules**: Add a module system for better code organization and reusability.

9. **Debugger**: Create a debugger for easier development and troubleshooting.

10. **REPL**: Implement a Read-Eval-Print Loop for interactive programming.

These improvements would significantly enhance the language's capabilities, performance, and developer experience.
4. **Garbage Collection**: Implement a garbage collector for automatic memory management.
5. **REPL**: Implement a Read-Eval-Print Loop for interactive programming.
132 changes: 0 additions & 132 deletions example.ai

This file was deleted.

File renamed without changes.
File renamed without changes.
14 changes: 0 additions & 14 deletions gg.ai

This file was deleted.

Binary file added ui/dist/favicon-f402c8741ce815ec.ico
Binary file not shown.
Binary file added ui/dist/icon-1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/dist/icon-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/dist/icon_ios_touch_192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
153 changes: 153 additions & 0 deletions ui/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- Disable zooming: -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

<head>
<!-- change this to your project name -->
<title>ui</title>

<!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->

<script type="module" nonce="18+mC4po11DXNHt22H1M0A==">
import init, * as bindings from '/ui-2df1291d7628ef2b.js';
const wasm = await init('/ui-2df1291d7628ef2b_bg.wasm');


window.wasmBindings = bindings;


dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}}));

</script>
<!-- this is the base url relative to which other urls will be constructed. trunk will insert this from the public-url option -->
<base href="/" />

<link rel="icon" href="/favicon-f402c8741ce815ec.ico" integrity="sha384&#x2D;jNOAE6jgE03LznIulCTVP6BH4NrTuROFjP9wj8bV1UUMJKtZAvstFpIAP3PDcFpx"/>










<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="icon_ios_touch_192.png">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#404040">

<style>
html {
/* Remove touch delay: */
touch-action: manipulation;
}

body {
/* Light mode background color for what is not covered by the egui canvas,
or where the egui canvas is translucent. */
background: #909090;
}

@media (prefers-color-scheme: dark) {
body {
/* Dark mode background color for what is not covered by the egui canvas,
or where the egui canvas is translucent. */
background: #404040;
}
}

/* Allow canvas to fill entire web page: */
html,
body {
overflow: hidden;
margin: 0 !important;
padding: 0 !important;
height: 100%;
width: 100%;
}

/* Position canvas in center-top: */
canvas {
margin-right: auto;
margin-left: auto;
display: block;
position: absolute;
top: 0%;
left: 50%;
transform: translate(-50%, 0%);
}

.centered {
margin-right: auto;
margin-left: auto;
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #f0f0f0;
font-size: 24px;
font-family: Ubuntu-Light, Helvetica, sans-serif;
text-align: center;
}

/* ---------------------------------------------- */
/* Loading animation from https://loading.io/css/ */
.lds-dual-ring {
display: inline-block;
width: 24px;
height: 24px;
}

.lds-dual-ring:after {
content: " ";
display: block;
width: 24px;
height: 24px;
margin: 0px;
border-radius: 50%;
border: 3px solid #fff;
border-color: #fff transparent #fff transparent;
animation: lds-dual-ring 1.2s linear infinite;
}

@keyframes lds-dual-ring {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}

</style>

<link rel="modulepreload" href="/ui-2df1291d7628ef2b.js" crossorigin=anonymous integrity="sha384-XUI0JqAmK73+wH2/dZJCD4hkd96aC5KcVOpCFDWYH4FXAPYKn2RywLyxZLnMPOMI">
<link rel="preload" href="/ui-2df1291d7628ef2b_bg.wasm" crossorigin=anonymous integrity="sha384-n1A05ZdFOD++5LfoseO9SNQyK7OIT/pfG4CU15FldgufNjRTP0RFgZ15iwSLiYZ1" as="fetch" type="application/wasm"></head>

<body>
<!-- The WASM code will resize the canvas dynamically -->
<!-- the id is hardcoded in main.rs . so, make sure both match. -->
<canvas id="the_canvas_id"></canvas>

<!--Register Service Worker. this will cache the wasm / js scripts for offline use (for PWA functionality). -->
<!-- Force refresh (Ctrl + F5) to load the latest files instead of cached files -->
<script>
// We disable caching during development so that we always view the latest version.
if ('serviceWorker' in navigator && window.location.hash !== "#dev") {
window.addEventListener('load', function () {
navigator.serviceWorker.register('sw.js');
});
}
</script>
</body>

</html>

<!-- Powered by egui: https://github.com/emilk/egui/ -->
Loading
Loading