Code Monkey home page Code Monkey logo

kal's Introduction

English Korean

🗡️ KALANG

KALANG logo

KALANG: Korean Programming Language.

  • < 0.03 MB.
  • Tested with >250 cases.
  • JavaScript-implemented, which runs natively on web browsers.
  • Minimal syntax with Korean keywords.

Try KALANG at Playground.

You can load a KALANG interpreter in browsers, or build manually (see below).

🗡️ Installation

Load the interpreter script in HTML as follows:

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

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

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

You can attach an event handler for standard output writing as follows:

const stdouts = [];

kal.execute("쓰기('사과')", stdout => stdouts.push(stdout)); // stdout === ["사과"]

🗡️ Examples

Statements and expressions

Variable assignment:

사과 = 42

Comparison:

사과 < 99

Conditional statement:

만약 사과 < 99 {
    사과 = 99
} 아니면 {
    사과 = 100
}

Defining and calling function:

더하기 = 함수(숫자1, 숫자2) {
    결과 숫자1 + 숫자2
}

더하기(42, 10)

which yields 52.

Closure and currying:

더하기 = 함수(숫자1) {
    결과 함수(숫자2) {
        결과 숫자1 + 숫자2
    }
}

하나더하기 = 더하기(1)

하나더하기(42)

더하기(1)(42)

which yields 43 twice.

Builtin functions

쓰기():

쓰기('사과')
쓰기('포도', '바나나')

which yields

사과
포도 바나나

길이():

길이('사과')

which yields 2.

Types

Number type: any floating-point numbers

사과 = 42
포도 = -9.5

String type: characters surrounded with single quotes

사과 = '맛있음'

Boolean type: , 거짓

사과 = 참
포도 = 거짓

🗡️ Building

Note that building process is based on Node.js.

With pnpm, you can build a KALANG interpreter by running pnpm install && pnpm build.

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

kal's People

Contributors

wcho21 avatar

Stargazers

NaGyeong Park avatar

Watchers

 avatar

kal's Issues

0.2.1

minor features

  • curried function call, e.g., foo(1)(2): #62

docs

  • update curried function call support: #64

release

1.0.0

WIP

better error handling interface

0.3.0

WIP 0.3.0

New data types

List (배열)

Support list (배열) data type.

  • List literal [ ... ].

Support built-in functions for list.

  • 길이(list): get length of list.
  • 넣기(list, item): push item to list.
  • 빼기(list): pop an item from list.
  • 쓰기(list): write list as a string

Table (표)

Support table (표) data type.

  • Table literal { ... }.

Support built-in functions for table.

  • 길이(table): get length of table.
  • 넣기(table, key, value): push key and value pair to table.
  • 빼기(table, key): pop a value with key from table.
  • 쓰기(table): write table as a string

Comment

Support comment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.