Skip to content

Commit

Permalink
chore: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zyrouge committed Oct 18, 2023
1 parent 0b66103 commit 483d808
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 31 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Beize Scripting Language
Copyright (C) 2023 Zyrouge

This program is free software: you can redistribute it and/or modify
Expand Down
196 changes: 196 additions & 0 deletions docs/Native-APIs/math.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Math

## `Math.random`

Returns a random value within `0` and `1`.

```title="Signature"
-> : Number
```

```title="Example"
value := Math.random();
# prints 0.3245124
print(value);
```

## `Math.pi`

Returns the value of PI.

```title="Signature"
-> : Number
```

```title="Example"
pi := Math.pi();
# prints 3.1415926535897932
print(pi);
```

## `Math.sin`

Returns sine of the value.

```title="Signature"
-> Number value : Number
```

```title="Example"
value := Math.sin(1);
# prints 0.8414709848078965
print(value);
```

## `Math.cos`

Returns cosine of the value.

```title="Signature"
-> Number value : Number
```

```title="Example"
value := Math.cos(1);
# prints 0.5403023058681398
print(value);
```

## `Math.tan`

Returns tangent of the value.

```title="Signature"
-> Number value : Number
```

```title="Example"
value := Math.tan(1);
# prints 1.5574077246549023
print(value);
```

## `Math.asin`

Returns arc sine of the value.

```title="Signature"
-> Number value : Number
```

```title="Example"
value := Math.asin(1);
# prints 1.5707963267948966
print(value);
```

## `Math.acos`

Returns arc cosine of the value.

```title="Signature"
-> Number value : Number
```

```title="Example"
value := Math.acos(1);
# prints 0
print(value);
```

## `Math.atan`

Returns arc tangent of the value.

```title="Signature"
-> Number value : Number
```

```title="Example"
value := Math.atan(1);
# prints 0.7853981633974483
print(value);
```

## `Math.atan2`

A variant of `Math.atan`.

```title="Signature"
-> Number a, Number b : Number
```

```title="Example"
value := Math.atan2(1, 2);
# prints 0.4636476090008061
print(value);
```

## `Math.exp`

Returns natural exponent of the value.

```title="Signature"
-> Number value : Number
```

```title="Example"
value := Math.exp(1);
# prints 2.718281828459045
print(value);
```

## `Math.log`

Returns natural logarithm of the value.

```title="Signature"
-> Number value : Number
```

```title="Example"
value := Math.log(2);
# prints 0.6931471805599453
print(value);
```

## `Math.min`

Returns minimum value in `a` and `b`.

```title="Signature"
-> Number a, Number b : Number
```

```title="Example"
value := Math.min(-1, 1);
# prints -1
print(value);
```

## `Math.max`

Returns maximum value in `a` and `b`.

```title="Signature"
-> Number a, Number b : Number
```

```title="Example"
value := Math.max(-1, 1);
# prints 1
print(value);
```
6 changes: 3 additions & 3 deletions packages/beize_cli/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
description:
path: "packages/beize_shared"
ref: HEAD
resolved-ref: "4ce93fff555a14a0cb99e65e7a24a52859d2a249"
resolved-ref: "0b6610337e9f95ac6aebbe0da20fa3b050ec2478"
url: "https://github.com/zyrouge/beize.git"
source: git
version: "0.0.0"
Expand All @@ -36,10 +36,10 @@ packages:
dependency: "direct main"
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
lint:
dependency: transitive
description:
Expand Down
48 changes: 24 additions & 24 deletions packages/beize_compiler/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a
sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49"
url: "https://pub.dev"
source: hosted
version: "61.0.0"
version: "65.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562
sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07
url: "https://pub.dev"
source: hosted
version: "5.13.0"
version: "6.3.0"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -59,10 +59,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
convert:
dependency: transitive
description:
Expand All @@ -75,10 +75,10 @@ packages:
dependency: transitive
description:
name: coverage
sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097"
sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb"
url: "https://pub.dev"
source: hosted
version: "1.6.3"
version: "1.6.4"
crypto:
dependency: transitive
description:
Expand Down Expand Up @@ -171,10 +171,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.11.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -283,18 +283,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
Expand All @@ -315,26 +315,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46"
sha256: d983a57c33dde6d44b1fb8635f67c91f4b41d26cf227c147963affa97d63563d
url: "https://pub.dev"
source: hosted
version: "1.24.3"
version: "1.24.8"
test_api:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
test_core:
dependency: transitive
description:
name: test_core
sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e"
sha256: "2f866bf4b20c11327ac166ee6036bddafb7fe9e35505ff8324f788e66913f967"
url: "https://pub.dev"
source: hosted
version: "0.5.3"
version: "0.5.8"
typed_data:
dependency: transitive
description:
Expand All @@ -347,10 +347,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: c620a6f783fa22436da68e42db7ebbf18b8c44b9a46ab911f666ff09ffd9153f
sha256: a13d5503b4facefc515c8c587ce3cf69577a7b064a9f1220e005449cf1f64aad
url: "https://pub.dev"
source: hosted
version: "11.7.1"
version: "12.0.0"
watcher:
dependency: transitive
description:
Expand All @@ -371,10 +371,10 @@ packages:
dependency: transitive
description:
name: webkit_inspection_protocol
sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d"
sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.2.1"
yaml:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion packages/beize_vm/lib/vm/call_frame.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BeizeCallFrame {
}
return BeizeInterpreterResult.fail(
BeizeExceptionValue(
'RuntimeException: Value "${value.kind.code}" is not callable',
'BeizeRuntimeException: Value "${value.kind.code}" is not callable',
getStackTrace(),
),
);
Expand Down
4 changes: 2 additions & 2 deletions packages/beize_vm/lib/vm/interpreter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BeizeInterpreter {
state = BeizeInterpreterState.finished;
return BeizeInterpreterResult.fail(
BeizeExceptionValue(
'RuntimeException: $err',
'BeizeRuntimeException: $err',
frame.getStackTrace(),
stackTrace.toString(),
),
Expand All @@ -56,7 +56,7 @@ class BeizeInterpreter {
state = BeizeInterpreterState.finished;
return BeizeInterpreterResult.fail(
BeizeExceptionValue(
'RuntimeException: $err',
'BeizeRuntimeException: $err',
frame.getStackTrace(),
stackTrace.toString(),
),
Expand Down

0 comments on commit 483d808

Please sign in to comment.