애플리케이션의 의도를 간결하고 일관된 문법으로 표현하는 프로그래밍 언어.
Topaz 살펴보기
언어를 배우고, 필요한 실행 대상을 고르고, Topaz가 발전해 온 과정과 앞으로의 계획을 살펴보세요.
지금 실행하면 아래와 같은 결과를 얻습니다.
function clean(words: Array<string>) -> Array<string> {
return filter(words, (w: string) => w != "")
}
function shout(words: Array<string>) -> Array<string> {
return map(words, (w: string) => w + "!")
}
let line = ["one", "", "way", "", "to", "say", "it"]
|> clean
|> shout
print("{line}")[one!, way!, to!, say!, it!]
같은 뜻을 여러 방식으로 쓰지 않아 코드가 쉽게 읽힙니다.
한글, 키릴 문자, 이모지 등 도메인의 이름을 그대로 코드에 씁니다.
사람과 코드 생성 도구가 같은 문법을 사용하고 같은 검사를 받습니다.
SQL, 셸, 경로 템플릿이 원문과 값이 들어갈 자리를 구분해 보존합니다.
사람이 읽기 쉽고, 컴퓨터가 그대로 실행할 수 있습니다.
Topaz는 애플리케이션 의도를 간결하게 표현하는 유니코드 우선 언어입니다. 사람과 코드 생성 도구가 같은 문법을 사용하며, 작성한 프로그램을 바로 실행하거나 Rust·Python·웹 산출물로 만들 수 있습니다.
철학 읽기 →function discount(customer: { tier: string, years: int }) -> float {
return match customer {
case { tier: "vip", years } if years > 5 => 0.3
case { tier: "vip" } => 0.2
case { years } if years > 1 => 0.1
case _ => 0.0
}
}
print("{discount({ tier: "vip", years: 7 })}")
print("{discount({ tier: "new", years: 0 })}")0.3 0.0
let result = concurrent {
answer: 6 * 7
status: "ready"
}
defer print("cleaned up")
print("{result.answer} {result.status}")42 ready cleaned up
function fibonacci(n: int) -> int {
return match n {
case 0 => 0
case 1 => 1
case _ => fibonacci(n - 1) + fibonacci(n - 2)
}
}
let series = map(0..<10, fibonacci)
print("{series}")[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
function clean(words: Array<string>) -> Array<string> {
return filter(words, (w: string) => w != "")
}
function shout(words: Array<string>) -> Array<string> {
return map(words, (w: string) => w + "!")
}
let line = ["one", "", "way", "", "to", "say", "it"]
|> clean
|> shout
print("{line}")[one!, way!, to!, say!, it!]
function 인사하기(이름: string) -> string {
return "안녕하세요, {이름}님!"
}
print(인사하기("토파즈"))안녕하세요, 토파즈님!
function greet(name: string) -> string {
return "Hello, {name}!"
}
print(greet("Topaz"))Hello, Topaz!
function привет(имя: string) -> string {
return "Привет, {имя}!"
}
print(привет("Топаз"))Привет, Топаз!
의도는 당신이 쓰고, 컴파일러는 Rust와 Python을 만든다.
사용 가능 — 예제 69개 검사
사용 가능 — 여러 파일로 구성된 프로그램
사용 가능 — 이 페이지의 모든 프로그램 실행
사용 가능 — Rust 소스와 네이티브 프로그램 생성
사용 가능 — Python 소스와 실행 지원 파일 생성
사용 가능 — 빠짐없이 검사하는 match