Skip to content

Latest commit

ย 

History

History
157 lines (105 loc) ยท 2.7 KB

README.ko.md

File metadata and controls

157 lines (105 loc) ยท 2.7 KB

English Korean

๐Ÿ—ก๏ธ KALANG

KALANG logo

KALANG: Korean Programming Language.

ํ•œ๊ตญ์–ด ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด.

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

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

KALANG ์ธํ„ฐํ”„๋ฆฌํ„ฐ๋ฅผ ๋ธŒ๋ผ์šฐ์ €์— ๋กœ๋“œํ•˜๊ฑฐ๋‚˜ ์ง์ ‘ ๋นŒ๋“œํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์•„๋ž˜๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

๋ธŒ๋ผ์šฐ์ €์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ธํ„ฐํ”„๋ฆฌํ„ฐ ์Šคํฌ๋ฆฝํŠธ๋ฅผ HTML ์ƒ์—์„œ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.

<script src="https://cdn.jsdelivr.net/gh/wcho21/kal@latest/dist/index.min.js"></script>

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

kal.execute("5+5"); // === 10

ํ‘œ์ค€ ์ถœ๋ ฅ์„ ์œ„ํ•ด ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

const stdouts = [];

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

๐Ÿ—ก๏ธ ์˜ˆ์‹œ

๋ฌธ๋ฒ•๋“ค

๋ณ€์ˆ˜ ๋Œ€์ž…ํ•˜๊ธฐ:

์‚ฌ๊ณผ = 42

๊ฐ’ ๋น„๊ตํ•˜๊ธฐ:

์‚ฌ๊ณผ < 99

์กฐ๊ฑด๋ฌธ ์“ฐ๊ธฐ:

๋งŒ์•ฝ ์‚ฌ๊ณผ < 99 {
    ์‚ฌ๊ณผ = 99
} ์•„๋‹ˆ๋ฉด {
    ์‚ฌ๊ณผ = 100
}

ํ•จ์ˆ˜ ์‚ฌ์šฉํ•˜๊ธฐ:

๋”ํ•˜๊ธฐ = ํ•จ์ˆ˜(์ˆซ์ž1, ์ˆซ์ž2) {
    ๊ฒฐ๊ณผ ์ˆซ์ž1 + ์ˆซ์ž2
}

๋”ํ•˜๊ธฐ(42, 10)

๊ฒฐ๊ณผ๋Š” 52์ž…๋‹ˆ๋‹ค.

ํด๋กœ์ € ๋ฐ ์ปค๋ง:

๋”ํ•˜๊ธฐ = ํ•จ์ˆ˜(์ˆซ์ž1) {
    ๊ฒฐ๊ณผ ํ•จ์ˆ˜(์ˆซ์ž2) {
        ๊ฒฐ๊ณผ ์ˆซ์ž1 + ์ˆซ์ž2
    }
}

ํ•˜๋‚˜๋”ํ•˜๊ธฐ = ๋”ํ•˜๊ธฐ(1)

ํ•˜๋‚˜๋”ํ•˜๊ธฐ(42)

๋”ํ•˜๊ธฐ(1)(42)

๊ฒฐ๊ณผ๋Š” ๋‘˜ ๋‹ค 42์ž…๋‹ˆ๋‹ค.

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

์“ฐ๊ธฐ():

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

๊ฒฐ๊ณผ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์‚ฌ๊ณผ
ํฌ๋„ ๋ฐ”๋‚˜๋‚˜

๊ธธ์ด():

๊ธธ์ด('์‚ฌ๊ณผ')

๊ฒฐ๊ณผ๋Š” 2์ž…๋‹ˆ๋‹ค.

ํƒ€์ž…๋“ค

์ˆซ์ž ํƒ€์ž…: ์•„๋ฌด ๋ถ€๋™์†Œ์ˆ˜์  ์ˆซ์ž

์‚ฌ๊ณผ = 42
ํฌ๋„ = -9.5

๋ฌธ์ž์—ด ํƒ€์ž…: ์ž‘์€๋”ฐ์˜ดํ‘œ๋กœ ๋‘˜๋Ÿฌ์‹ผ ๋ฌธ์ž๋“ค

์‚ฌ๊ณผ = '๋ง›์žˆ์Œ'

๋ถˆ๋ฆฌ์–ธ ํƒ€์ž…: ์ฐธ, ๊ฑฐ์ง“

์‚ฌ๊ณผ = ์ฐธ
ํฌ๋„ = ๊ฑฐ์ง“

๐Ÿ—ก๏ธ ๋นŒ๋“œ์™€ ์„ค์น˜

๋นŒ๋“œํ•˜๊ธฐ

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

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

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