Skip to content

Commit

Permalink
update readme (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcho21 authored Feb 5, 2024
1 parent 68a1959 commit 48d41fb
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 23 deletions.
43 changes: 35 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
_KALANG: Korean Programming Language_.

- < 0.03 MB.
- Written in JavaScript. Natively runs on web browsers.
- Tested with >250 cases
- Written in JavaScript, natively runs on web browsers.
- Minimal syntax with Korean keywords.

Try _KALANG_ at [Playground][playground].
Expand All @@ -34,10 +35,15 @@ Load the interpreter script in HTML as follows:

After that, you can execute _KALANG_ code with `kal.execute(code-to-execute)` as follows:

```HTML
<script>
kal.execute("5+5"); // === 10
</script>
```javascript
kal.execute("5+5"); // === 10
```

You can attach an event handler for standard output writing as follows:
```javascript
const stdouts = [];

kal.execute("์“ฐ๊ธฐ('์‚ฌ๊ณผ')", stdout => stdouts.push(stdout)); // stdout === ["์‚ฌ๊ณผ"]
```


Expand Down Expand Up @@ -91,6 +97,27 @@ which yields `43`.



### Builtin functions

`์“ฐ๊ธฐ()`:
```
์“ฐ๊ธฐ('์‚ฌ๊ณผ')
์“ฐ๊ธฐ('ํฌ๋„', '๋ฐ”๋‚˜๋‚˜')
```
which yields
```
์‚ฌ๊ณผ
ํฌ๋„ ๋ฐ”๋‚˜๋‚˜
```

`๊ธธ์ด()`:
```
๊ธธ์ด('์‚ฌ๊ณผ')
```
which yields `2`.



### Types

_Number type_: any floating-point numbers
Expand All @@ -116,9 +143,9 @@ _Boolean type_: `์ฐธ`, `๊ฑฐ์ง“`

Note that building process is based on [Node.js][node].

With [`pnpm`][pnpm], you can build a _KALANG_ interpreter by running `pnpm install && pnpm build && pnpm bundle`.
With [`pnpm`][pnpm], you can build a _KALANG_ interpreter by running `pnpm install && pnpm build`.

The output will be in the directory `/bundle/index.js`.
The output will be in the directory `/dist/index.min.js`.

[pnpm]: https://pnpm.io/
[node]: https://nodejs.org/
[pnpm]: https://pnpm.io/
51 changes: 36 additions & 15 deletions docs/README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ _KALANG: Korean Programming Language_.
ํ•œ๊ตญ์–ด ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด.

- < 0.03 MB.
- ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์ž‘์„ฑ๋˜์–ด ๋ธŒ๋ผ์šฐ์ €์—์„œ ๋ฐ”๋กœ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.
- ํ•œ๊ตญ์–ด ํ‚ค์›Œ๋“œ๋กœ ๊ตฌ์„ฑ๋œ ๊ฐ„๋‹จํ•œ ๋ฌธ๋ฒ•์„ ๊ฐ–์Šต๋‹ˆ๋‹ค.
- 250 ๊ฐœ ์ด์ƒ์˜ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค.
- ๋ธŒ๋ผ์šฐ์ €์—์„œ ๋ฐ”๋กœ ๋™์ž‘ํ•˜๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ตฌํ˜„์ฒด.
- ํ•œ๊ตญ์–ด ํ‚ค์›Œ๋“œ๋กœ ๊ตฌ์„ฑ๋œ ๊ฐ„๋‹จํ•œ ๋ฌธ๋ฒ•.

_KALANG_ ์„ [ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ][playground]์—์„œ ์ฒดํ—˜ํ•ด๋ณด์„ธ์š”.

Expand All @@ -36,10 +37,15 @@ _KALANG_ ์ธํ„ฐํ”„๋ฆฌํ„ฐ๋ฅผ ๋ธŒ๋ผ์šฐ์ €์— ๋กœ๋“œํ•˜๊ฑฐ๋‚˜ ์ง์ ‘ ๋นŒ๋“œํ•˜๋Š”

์ดํ›„, _KALANG_ ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด `kal.execute(code-to-execute)`๋กœ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

```HTML
<script>
kal.execute("5+5"); // === 10
</script>
```javascript
kal.execute("5+5"); // === 10
```

ํ‘œ์ค€ ์ถœ๋ ฅ์„ ์œ„ํ•ด ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
```javascript
const stdouts = [];

kal.execute("์“ฐ๊ธฐ('์‚ฌ๊ณผ')", stdout => stdouts.push(stdout)); // stdout === ["์‚ฌ๊ณผ"]
```


Expand Down Expand Up @@ -93,6 +99,27 @@ _KALANG_ ์ธํ„ฐํ”„๋ฆฌํ„ฐ๋ฅผ ๋ธŒ๋ผ์šฐ์ €์— ๋กœ๋“œํ•˜๊ฑฐ๋‚˜ ์ง์ ‘ ๋นŒ๋“œํ•˜๋Š”



### ๋‚ด์žฅ ํ•จ์ˆ˜

`์“ฐ๊ธฐ()`:
```
์“ฐ๊ธฐ('์‚ฌ๊ณผ')
์“ฐ๊ธฐ('ํฌ๋„', '๋ฐ”๋‚˜๋‚˜')
```
๊ฒฐ๊ณผ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
```
์‚ฌ๊ณผ
ํฌ๋„ ๋ฐ”๋‚˜๋‚˜
```

`๊ธธ์ด()`:
```
๊ธธ์ด('์‚ฌ๊ณผ')
```
๊ฒฐ๊ณผ๋Š” `2`์ž…๋‹ˆ๋‹ค.



### ํƒ€์ž…๋“ค

_์ˆซ์ž ํƒ€์ž…_: ์•„๋ฌด ๋ถ€๋™์†Œ์ˆ˜์  ์ˆซ์ž
Expand Down Expand Up @@ -120,15 +147,9 @@ _๋ถˆ๋ฆฌ์–ธ ํƒ€์ž…_: `์ฐธ`, `๊ฑฐ์ง“`

๋นŒ๋“œ ๊ณผ์ •์€ [Node.js][node]๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค.

_KALANG_ ์ธํ„ฐํ”„๋ฆฌํ„ฐ๋ฅผ ๋‹ค์Œ ์ปค๋งจ๋“œ๋กœ [`pnpm`]์„ ์ด์šฉํ•ด ๋นŒ๋“œํ•ฉ๋‹ˆ๋‹ค.
[`pnpm`][pnpm]์„ ์ด์šฉํ•ด, _KALANG_ ์ธํ„ฐํ”„๋ฆฌํ„ฐ๋ฅผ `pnpm install && pnpm build`๋กœ ๋นŒ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

```
pnpm install && pnpm build && pnpm bundle`
```
๋นŒ๋“œ ๊ฒฐ๊ณผ๋Š” `/dist/index.min.js` ๋””๋ ‰ํ† ๋ฆฌ์— ์œ„์น˜ํ•ฉ๋‹ˆ๋‹ค.



๊ฒฐ๊ณผ๋Š” `/bundle/index.js` ๋””๋ ‰ํ† ๋ฆฌ์— ์œ„์น˜ํ•ฉ๋‹ˆ๋‹ค.

[pnpm]: https://pnpm.io/
[node]: https://nodejs.org/
[pnpm]: https://pnpm.io/

0 comments on commit 48d41fb

Please sign in to comment.