Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ph0enixKM committed May 24, 2024
2 parents 2563388 + c88d9a6 commit 5dc0583
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 37 deletions.
39 changes: 13 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
<div align="center">
<img src="https://amber-docs.vercel.app/internal/amber.svg" alt="amberlogo" height="25" width="25" />
</div>

## Getting Started
<div style="text-align: center;"> <h1> Official documentation of Amber </h1> </div>

First, run the development server:
## What is Amber?

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```
[Amber](https://amber-lang.com/) is a cutting-edge programming language compiled into Bash Script. With a focus on modern syntax, safety features, type safety, and practical functionalities that exceed the capabilities of Bash, Amber aims to provide a streamlined and robust scripting experience. The implementation is written in Rust and hosted [on GitHub](https://github.com/Ph0enixKM/Amber).

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
### Documentation Purpose

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This documentation serves as a comprehensive guide to understanding and utilizing the features of Amber. Whether you are a seasoned developer or a newcomer, this documentation will walk you through the unique aspects and advantages that Amber brings to the world of scripting.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
Explore the sections [here](https://docs.amber-lang.com/) to delve into Amber's syntax, safety measures, and practical functionalities, and discover how it can enhance your scripting workflow. If you have any questions or need assistance, feel free to reach out for support.

## Learn More
Happy scripting with Amber!

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
<div align="center">
<img src="https://amber-docs.vercel.app/internal/amber.svg" alt="amberlogo" height="25" width="25" />
</div>
10 changes: 5 additions & 5 deletions docs/basic_syntax/commands.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Commands

The only way to access bash shell is through Amber's commands. Command can be used in a form of statement or expression.
The only way to access the bash shell is through Amber's commands. Commands can be used in the form of a statement or an expression.

The important thing regarding commands is that they can `fail`. Failing is a new concept that forces caller to handle the failure. There are many ways to handle failure:
The important thing regarding commands is that they can `fail`. Failing is a new concept that forces the caller to handle the failure. There are many ways to handle failure:

- `failed` - the most recommended one that enables you to write some additional logic to run when command failed
- `?` - this a shorthand for propagating the failure to the caller. This operator can only be used in a `main` block or inside of a function.
- `unsafe` - the discouraged way to handle expressions. This command modifier will treat command as if it has completed successfully and will allow it to be parsed without any further steps.
- `failed` - the recommended way to handle failing that enables you to write some specific logic to run when a command fails
- `?` - this shorthand for propagating the failure to the caller. This operator can only be used in a `main` block or inside of a function.
- `unsafe` - the discouraged way to handle failing. This modifier will treat commands as if they have completed successfully and will allow them to be parsed without any further steps.

Here is an example use:

Expand Down
2 changes: 1 addition & 1 deletion docs/basic_syntax/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

There are three ways to perform conditional logic:
- **If Statement** - This is a regular if statement that can be used anywhere
- **If Chain** - This is a _syntax sugar_ for pesky if-else chained together.
- **If Chain** - This is _syntactical sugar_ for pesky if-else chained together.
- **Ternary Expression** - This is a way to represent conditional logic within an expression.

## If Statement
Expand Down
13 changes: 11 additions & 2 deletions docs/basic_syntax/expressions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Expressions

We can combine our data type literals with operators. The operators only work on **the same** data type. For example adding `Text` to `Num` will cause in error and is an unsupported operation. If you want to merge couple of different values into one text, learn more here about [string interpolation](/basic_syntax/expressions#text-interpolation)
We can combine our data type literals with operators. The operators only work on **the same** data type. For example adding `Text` to `Num` will cause in error and is an unsupported operation. If you want to merge multiple different values into one text, learn more here about [string interpolation](/basic_syntax/expressions#text-interpolation)

## Addition operator `+`

Expand Down Expand Up @@ -31,7 +31,16 @@ Arithmetic operations can only be used on `Num` data type. Here is the list of a

## Comparison operations

Comparison operations can only be used on `Num` data type as well. These are basically the same as in other modern programming languages: `==`, `!=`, `>`, `<`, `>=`, `<=`.
The equality `==` and inequality `!=` operations can be applied to any data type as long as both sides have the same type.

```ab
"foo" != "bar"
42 == 42
true != false
"equal" == "equal"
```

The remaining comparison operations can only be used on the `Num` data type. These are basically the same as in other modern programming languages: `>`, `<`, `>=`, `<=`.

```ab
42 != 24
Expand Down
3 changes: 3 additions & 0 deletions docs/basic_syntax/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ echo groceries
```

The behavior of this keyword is pretty similar to `&` in other C-like programming languages.

## Reserved Prefix
The Amber compiler reserves all identifiers starting with double underscore `__` in addition to keywords like `let`, `if`, etc.
2 changes: 2 additions & 0 deletions docs/basic_syntax/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ let result = 123
let result = "Hello my friend"
```

## Reserved Prefix
The Amber compiler reserves all identifiers starting with double underscore `__` in addition to keywords like `let`, `if`, etc.
14 changes: 11 additions & 3 deletions src/components/SettingsGrid/SettingsGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import Icon from '../Icon/Icon'
import Button from '../Button/Button'
import style from './SettingsGrid.module.css'
import { useTheme } from '@/contexts/ThemeContext'
import {useRouter} from 'next/navigation'

export default function SettingsGrid() {
const { mode, setThemeMode } = useTheme()
const router = useRouter()

const toggleTheme = () => {
setThemeMode(mode === 'light' ? 'dark' : 'light')
Expand All @@ -17,16 +19,22 @@ export default function SettingsGrid() {
<div className={style.buttons}>
<div className={style.button}>
<Button onClick={toggleTheme}>
<Icon src='/internal/moon.svg' size='2rem' />
<Icon src='/internal/moon.svg' size='2rem'/>
</Button>
</div>
<div className={style.button}>
<Button onClick={() => router.push('https://github.com/Ph0enixKM/Amber')}>
<Icon src='/internal/gh.svg' size='2rem'/>
</Button>
</div>
{/* Uncomment when we are ready */}
{/* <div className={style.button}>
<Button>
<a href="https://marble.software/">
<Icon src='/internal/marble.svg' size='2rem' />
<Icon src='/internal/marble.svg' size='2rem'/>
</a>
</Button>
</div>
</div> */}
</div>
</div>
)
Expand Down

0 comments on commit 5dc0583

Please sign in to comment.