Skip to content

Getting Started

MinJeong Hong edited this page Nov 12, 2025 · 7 revisions

목차


사전 준비

Note

Mint는 Node.js 기반으로 동작하므로, 최신 LTS 버전을 권장합니다.

요구사항 최소 버전 권장 버전 비고
Node.js 18.x 20 LTS LTS 버전 사용 권장
npm 9.x 10.x Node.js와 함께 설치됨

설치 방법

  1. 프로젝트 클론

    git clone https://github.com/mindaaaa/mint.git
    cd mint
  2. 의존성 설치

    npm install
  3. 빌드 (선택)

    CLI 실행 전 최신 dist가 필요하다면,

    npm run build

Tip

개발 중에는 npm run dev를 사용하면 파일 변경 시 자동으로 빌드됩니다.


첫 코드 작성

  1. 새 파일 생성 hello.mint

    sparkle "hello, mint!"
  2. 실행

    npm start -- run hello.mint
  3. 예상 출력

    🌿 Result
      hello, mint!
    

Tip

sparkle는 mint의 기본 키워드입니다.
더 많은 키워드와 문법은 언어 가이드를 참고하세요.


기본 예제 실행

프로젝트에 포함된 예제 파일들을 실행해보며 mint의 기능을 체험할 수 있습니다.

예제 파일 설명 실행 명령어
examples/conditional.mint 제어 흐름 npx mint run examples/conditional.mint
examples/functions.mint 함수 사용 npx mint run examples/functions.mint
examples/errors.mint 에러 시나리오 npx mint run examples/errors.mint

Note

에러 메시지 해석은 에러 이해하기을 참고하세요.

테스트 실행

npm test

자세한 테스트 전략은 테스트 전략에서 확인할 수 있습니다.


첫 코드 작성

Mint의 첫 코드를 작성해봅시다.


examples/my-first.mint 파일을 만들어보세요!

sparkle "hello, mint!"

이제 실행해봅시다👍

npx mint run examples/my-first.mint

예상 출력

🌿 Result
  hello, mint!

Note

sparkle은 Mint에서 콘솔에 값을 출력하는 키워드입니다.
감정을 담아 빛나는 순간을 표현한다는 의미를 담고 있습니다.


변수와 출력

변수를 선언하고 사용해봅시다.
plant 키워드로 값을 심어 정의합니다.

plant name = "mint whisperer"
plant age = 1

sparkle "I am " + name
sparkle "I am " + age + " year old"

실행 결과

🌿 Result
  I am mint whisperer
  I am 1 year old

Tip

💡 시도해보세요

  • 변수에 숫자를 더하거나, 문자열을 연결해보세요.

조건문과 반복문

조건문 breeze

조건이 바람처럼 스치면 블록을 실행합니다.

plant mood = "sunny"

breeze (mood == "sunny") softly {
  sparkle "time to bask in the sunlight"
}

breeze (mood == "rainy") softly {
  sparkle "let's listen to the raindrops"
}

실행 결과

🌿 Result
  time to bask in the sunlight

반복문 bloom

자연스럽게 반복이 피어납니다.

plant count = 0
plant limit = 3

bloom (count < limit) softly {
  sparkle count
  plant count = count + 1
}

실행 결과

🌿 Result
  0
  1
  2

Tip

💡 시도해보세요

  • limit 값을 바꿔보거나, 반복문 안에서 다른 변수를 출력해보세요.

함수 만들기

petal 키워드로 함수를 선언하고, gift로 값을 반환합니다.

petal greet(name) {
  sparkle "hello, " + name
  gift "🌼"
}

sparkle greet("mint whisperer")

실행 결과

🌿 Result
  hello, mint whisperer
  🌼

더 복잡한 예제를 시도해봅시다!

petal repeatTimes(text, times) {
  plant count = 0

  bloom (count < times) softly {
    sparkle text
    plant count = count + 1
  }

  gift "🌻"
}

sparkle repeatTimes("gentle breeze", 2)

실행 결과

🌿 Result
  gentle breeze
  gentle breeze
  🌻

Tip

💡 시도해보세요

  • 함수에 숫자를 전달해 계산 결과를 반환하는 함수를 만들어보세요!

다음 단계

이제 기본 문법을 익혔습니다! 다음 단계로 넘어가봅시다.

  1. 예제 파일 탐색

    프로젝트의 examples/ 폴더에 더 많은 예제가 있습니다.

    npx mint run examples/conditional.mint
    npx mint run examples/functions.mint
  2. 에러 체험

    의도적으로 에러를 발생시켜 메시지를 확인해보세요! 에러 메시지 해석은 에러 이해하기를 참고하세요.

    npx mint run examples/errors.mint
  3. 문법 가이드

    더 자세한 키워드와 문법은 언어 가이드에서 확인할 수 있습니다.

  4. 테스트 실행

    프로젝트의 테스트를 실행해보세요. 자세한 테스트 전략은 테스트 전략를 참고하세요.

    npm test

마지막 업데이트: 2025-11-12

Clone this wiki locally