needmoreeasy EN 한국어
Learn

NME syntax list

Every spelling NME actually accepts, in one place. For explanations, read the language reference; this file is a table, not a tour.

It is generated from the compiler source (python scripts/build-syntax-reference.py), and a check fails the build if the compiler accepts a spelling that is missing here — so the list cannot drift away from the implementation.

How to read this

  • Three levels. Sentence needs no quotes, commas, parentheses, equals signs or colons; beginner is short and exact; advanced is ordinary Python. They mix freely in one file and on one line, with nothing to declare.
  • Python wins. If a line is valid Python, NME leaves it alone. That is why a one-word line (skip, 멈춰) stays a Python name and only becomes an NME command inside a loop block.
  • One NME statement is one Python line. The line count never changes, so a traceback points at the line you actually wrote.
  • The Python produced column is exactly what the compiler emits.

1. Output

LevelNMEPython produced
Sentenceshow Hello world!print("Hello world!")
SentenceHello world showprint("Hello world")
SentenceHello everyone!print("Hello everyone!")
Sentenceshow Hello name!print("Hello " + str(name) + "!")
Beginnersay "Hello"print("Hello")
Beginnersay total + 1print(total + 1)
Advancedprint("Hello")unchanged

Text or code. After an action word, a valid Python expression whose names the program already knows is treated as code; anything else is text. say and 말해 are the exception: they try the expression first. A name introduced earlier is substituted into text (show Hello name!"Hello " + str(name) + "!").

2. Input

LevelNMEPython produced
Sentenceask name What is your name?name = input("What is your name?" + " ")
Sentenceask number age How old are you?age = int(input("How old are you?" + " "))
SentenceWhat is your name?name = input("What is your name?" + " ")
SentenceHow old are you?age = int(input("How old are you?" + " "))
Sentencename askname = input()
Beginnerask name, "Name? "name = input("Name? ")
Advancedname = input()unchanged

ask number / 숫자로 produces int(input(...)). A question about an age or a count (How old are you?, 몇 살이에요?) is read as a number without it. A prompt that does not end in a space gets one.

3. Save a value

LevelNMEPython produced
Sentenceset greeting to Hellogreeting = "Hello"
Sentenceset answer to 7answer = 7
Sentencegreeting save Hellogreeting = "Hello"
Beginnersave total to 1 + 2total = 1 + 2
Advancedgreeting = 'Hello'unchanged

Korean marks the target with the particle / and needs no action word. English has no such particle, so it uses set … to ….

4. Change a value

LevelNMEPython produced
Sentencescore add 1score = score + 1
Sentenceadd 1 to scorescore = score + 1
Sentencescore increase by 1score = score + 1
Sentencesubtract 1 from scorescore = score - 1
Sentencemultiply score by 2score = score * 2
Sentencedivide score by 2score = score / 2
Sentencesubtract 1 + 2 from scorescore = score - (1 + 2)
Advancedscore += 1unchanged

⚠ A multi-word amount is parenthesised: subtract 1 + 2 from score is score - (1 + 2), not score - 1 + 2.

5. Wait

LevelNMEPython produced
Sentencewait 3 seconds__import__("time").sleep(3)
Sentencepause 3__import__("time").sleep(3)
Sentencewait 1 second__import__("time").sleep(1)
Sentencewait for 5 seconds__import__("time").sleep(5)
Sentencesleep pause_length__import__("time").sleep(pause_length)
Advancedimport time; time.sleep(3)unchanged

The unit word (seconds, ) is optional. A line with no number in it (잠깐 기다려) stays ordinary output.

6. Repeat a number of times

LevelNMEPython produced
Sentencerepeat 3 times and show Againfor _ in range(3): print("Again")
Sentence3 times Welcomefor _ in range(3): print("Welcome")
Sentencerepeat 3 times … endfor _ in range(3):
Beginner3 times: say "Hi"for _ in range(3): print("Hi")
Advancedfor i in range(3):unchanged

A block closes three ways: by indentation, by one statement after :, or by a line containing only end / .

7. Repeat over a list

LevelNMEPython produced
Sentencefor each friend in friendsfor friend in friends:
Sentencefor each friend in friends and show friendfor friend in friends: print(friend)
Sentencerepeat for each name in namesfor name in names:
Beginnerfor each friend in friends:for friend in friends:
Advancedfor friend in friends:unchanged

The name before in / 마다 holds each item in turn, and the block body can use it immediately.

8. Repeat while a condition holds

LevelNMEPython produced
Sentencewhile score is less than 3while (score < 3):
Sentencewhile ready and waitingwhile (ready and waiting):
Sentencewhile ready then show workingwhile (ready): print("working")
Beginnerwhile score < 3while (score < 3):
Advancedwhile score < 3:unchanged

9. Conditions

LevelNMEPython produced
Sentenceif score is greater than 10 then show You wonif (score > 10): print("You won")
Sentenceif name existsif (name):
Sentencescore is greater than 5 then show highif (score > 5): print("high")
Sentenceelse if score equals 0elif (score == 0):
Sentenceelseelse:
Beginnerwhen score == 1: say "one"if (score == 1): print("one")
Advancedif score == 1:unchanged

10. Comparison vocabulary

NMEPythonMeaning
if name existsname참인 값 / truthy
if name missingnot (name)거짓인 값 / falsey
if score equals 10score == 10==
if score is not equal to 10score != 10!=
if score is greater than 10score > 10>
if score is less than 10score < 10<
if score is greater than or equal to 10score >= 10>=
if score is less than or equal to 10score <= 10<=
if ready and score > 2ready and score > 2and / 그리고
if ready or waitingready or waitingor / 또는

English accepts synonyms for the comparison words: greater, above, great, larger, bigger, higher all mean >; less, below, small, smaller, lower all mean <; equals, equal, same mean ==.

11. Loop control

LevelNMEPython produced
Sentencebreakbreak
Sentencebreak herebreak
Sentenceskipcontinue
Sentenceend(closes the block)

break and skip (멈춰, 건너뛰어) are valid Python names on their own, so they are read as NME only inside a loop block. Outside one they stay Python.

12. Lists

LevelNMEPython produced
Sentenceset friends to list of Mina, Adafriends = ["Mina", "Ada"]
Sentenceset friends to list of Mina and Adafriends = ["Mina", "Ada"]
Sentenceset scores to list of 1, 2, 3scores = [1, 2, 3]
Sentenceset friends to list offriends = []
Sentenceappend Mina to friendsfriends.append("Mina")
Sentencepush Mina to friendsfriends.append("Mina")
Advancedfriends = ["Mina"]unchanged

Without the list of / 목록 marker a comma-separated line is ordinary text. append Mina to friends (a list) and add 1 to score (a number) are different commands and keep their own meanings.

13. Values and literals

EnglishKoreanPython
True · trueTrue
False · false거짓False
None · none · null없음None

14. Randomness

LevelNMEPython produced
Sentenceset die to random number from 1 to 6die = __import__("random").randint(1, 6)
Sentenceset color to pick from red or greencolor = __import__("random").choice(("red", "green",))
Beginneruse random(binds the random helpers)
Beginnersay random_number(1, 6)print(random_number(1, 6))

A choice written as a number stays a number (pick from 1 or 2choice((1, 2,))).

15. Files

LevelNMEPython produced
Sentenceread "notes.txt" into memomemo = __import__("pathlib").Path("notes.txt").read_text()
Sentencewrite "hello" to "out.txt"__import__("pathlib").Path("out.txt").write_text("hello")
Beginneruse file(binds the file helpers)
Beginnersay file_read("notes.txt")print(file_read("notes.txt"))

A file path is always quoted. This is the one place the sentence level asks for a quote character.

16. Modules

LevelNMEPython produced
Beginneruse random(binds random, random_number, random_pick, shuffle and their Korean twins)
Beginneruse file(binds file_read, file_write, json_load, json_save and their Korean twins)
Beginneruse zero_knowledge(binds zk_secret, zk_public, zk_nizk_prove, … and their Korean twins)
Beginneruse random latest(the newest bundled adapter)
Beginneruse random version "0.0.1"(that exact adapter)
Advancedfrom "helper.nme" import greet(from helper import greet — needs helper.nme next to the program)

17. Slow text

LevelNMEPython produced
Sentencesay slowly Hello[print(_ch, end="", flush=True) or __import__("time").sleep(0.04) for _ch in "Hello"]; print()
Sentenceshow slowly Hello[print(_ch, end="", flush=True) or __import__("time").sleep(0.04) for _ch in "Hello"]; print()
Sentencesay very slowly Hello[print(_ch, end="", flush=True) or __import__("time").sleep(0.12) for _ch in "Hello"]; print()
Sentencesay slowly every 3 seconds Hello[print(_ch, end="", flush=True) or __import__("time").sleep(3) for _ch in "Hello"]; print()

Each character is printed on its own with a short pause after it. The pause is 0.04 seconds by default, 0.12 with very, and whatever you name with every 3 seconds / 3초씩.

18. Screen

LevelNMEPython produced
Sentenceclear the screenprint("\033[2J\033[3J\033[H", end="")
Sentenceclear screenprint("\033[2J\033[3J\033[H", end="")
Sentencedraw a lineprint("─" * 40)
Sentencedraw lineprint("─" * 40)
Sentencesay in a box Helloprint((lambda _t: (lambda _w: "┌" + "─" * (_w + 2) + "┐\n│ " + _t + " │\n└" + "─" * (_w + 2) + "┘")(sum(2 if __import__("unicodedata").east_asian_width(_c) in "WF" else 1 for _c in _t)))("Hello"))
Sentencesay in the middle Helloprint((lambda _t: " " * max(0, (40 - sum(2 if __import__("unicodedata").east_asian_width(_c) in "WF" else 1 for _c in _t)) // 2) + _t)("Hello"))

Clearing the screen sends a terminal control sequence, so somewhere that is not a terminal it may show up as text. The box and the centred line count a Korean character as two columns, so a Korean sentence comes out straight; the width is 40 columns.

19. The stopwatch

LevelNMEPython produced
Sentencestart the timer_nme_clock = __import__("time").time()
Sentencestart timer_nme_clock = __import__("time").time()
Sentenceshow elapsedprint(round(__import__("time").time() - _nme_clock, 2))
Sentenceset spent to elapsedspent = round(__import__("time").time() - _nme_clock, 2)

start the timer starts the clock and elapsed / 잰시간 / 걸린시간 reads how many seconds have passed, to two decimal places. It is a value, so it works in output, in a saved name, and in a condition (if elapsed is greater than 3). Reading it without starting the clock is reported at compile time as E0226. A name the program made itself always wins over the word.

20. Cooldowns

LevelNMEPython produced
Sentenceput door on cooldown for 3 seconds_nme_cool_door = __import__("time").time() + 3
Sentencewhen door is readyif (__import__("time").time() >= _nme_cool_door):
Sentenceif door is readyif (__import__("time").time() >= _nme_cool_door):
Sentencewhen door is on cooldownif (__import__("time").time() < _nme_cool_door):
Sentencewait for door__import__("time").sleep(max(0, _nme_cool_door - __import__("time").time()))
Sentencepause for door__import__("time").sleep(max(0, _nme_cool_door - __import__("time").time()))

One cooldown belongs to one name. put door on cooldown for 3 seconds remembers the moment three seconds from now, and is ready / 쿨타임이 끝났으면 asks whether that moment has passed. They are conditions, so they work with when, while, else if, and the one-line form of all three. wait for door also reads as an ordinary English sentence, so a name the program already saved as something else is not read as a cooldown.

21. Every action word

Every spelling accepted for each action, with nothing left out.

ActionEnglish spellingsKorean spellings
출력 / Outputsay · show · display · tell · print말해 · 말해줘 · 말해주세요 · 보여줘 · 보여주세요 · 출력해 · 출력해줘 · 출력해주세요 · 해줘 · 해주세요 · 읽어줘
입력 / Inputask · prompt · question물어봐 · 물어봐줘 · 물어보세요 · 질문해 · 질문해줘 · 입력받아 · 입력받아줘 · 입력받아주세요 · 물어봐요 · 물어봐주세요 · 질문해주세요
저장 / Saveset · save · remember저장 · 저장해 · 기억해 · 기억해줘 · 설정 · 설정해
더하기 / Addadd · increase · increment · plus더해 · 더해줘 · 올려 · 올려줘 · 늘려 · 늘려줘
빼기 / Subtractsubtract · decrease · decrement · minus · remove · 빼줘 · 내려 · 내려줘 · 줄여 · 줄여줘
곱하기 / Multiplymultiply · multiplied곱해 · 곱해줘 · 곱하기해
나누기 / Dividedivide · divided나눠 · 나눠줘 · 나누어줘
기다리기 / Waitwait · pause · sleep기다려 · 기다려줘 · 기다리세요 · 기다려주세요 · 쉬어 · 쉬어줘 · 쉬세요
반복 / Repeatrepeat · again · do반복 · 반복해 · 반복해줘 · 반복해주세요 · 반복하세요 · 반복해서 · 반복하고 · 반복한다음 · 다시해 · 다시해주세요
조건 / Ifwhen · if만약 · 만약에 · 만일 · 혹시
조건 반복 / Whilewhile동안 · 하는동안 · 할동안
다른 갈래 / Elseelse · otherwise아니면 · 그렇지않으면 · 아니면만약 · 아니면만약에 · 그렇지않으면만약 · 그렇지않으면만약에
반복 중단 / Breakbreak · breakhere멈춰 · 멈춰라 · 중단 · 반복멈춰 · 여기서멈춰
건너뛰기 / Skipskip · skipthis · skipit · nextone건너뛰어 · 건너뛰어줘 · 건너뛰기 · 건너뛰자 · 넘어가 · 넘어가줘
블록 닫기 / Endend
모듈 쓰기 / Useuse · load · get · import사용 · 사용해 · 사용해줘 · 사용해주세요 · 불러와 · 불러와줘 · 가져와 · 가져와줘 · 받아 · 받아줘
목록에 넣기 / Appendappend · push넣어 · 넣어줘 · 추가해 · 추가해줘 · 붙여 · 붙여줘
목록 표시 / Listlist목록 · 리스트
숫자로 / As a numbernumber · numeric숫자 · 숫자로 · 수로
최신판 / Latestlatest · newest최신 · 최신판 · 최신버전
파일 읽기 / File readread읽어서 · 읽고 · 읽어
파일 쓰기 / File writewrite저장해 · 저장해줘 · 써줘 · 적어
천천히 / Slowlyslowly천천히
아주 / Veryvery아주
글자 간격 / Intervalevery초씩
화면 / Clear screenclear화면
화면 지우기 / Clear screen actionscreen지워 · 지워줘 · 비워 · 비워줘
줄 / Draw linedraw · 가로줄
줄 긋기 / Draw line actionline그어 · 그어줘
상자 / Boxbox상자로
가운데 / Middlemiddle가운데
시간 재기 / Start timerstart시간재기시작해 · 시간재기시작
시계 / Timertimer
잰 시간 / Elapsedelapsed잰시간 · 걸린시간
쿨타임 / Cooldowncooldown쿨타임 · 쿨타임을 · 쿨타임은 · 쿨타임이
쿨타임 걸기 / Put on cooldownput걸어 · 걸어줘
쿨타임 끝남 / Readyready끝났으면
쿨타임 남음 / On cooldown남았으면
쿨타임 끝날 때까지 / Until ready끝날때까지
군말 / Fillerplease · 혹시 · 제발

22. Korean particles

These endings are not treated as part of the name they follow.

에게서는 · 한테서는 · 에게서 · 한테서 · 으로는 · 로는 · 에게 · 한테 · 에서 · 으로 · 까지 · 부터 · 처럼 · 보다 · 이라도 · 라도 · 에는 · 에서 · · · · · · · · · · · · · · · · 이랑 · 예요 · 이에요

23. Typo recovery

For action words and connectors only, and only after Python has rejected the line, NME retries once with a single edit repaired (one insertion, deletion, substitution, or adjacent swap). If more than one repair is possible it repairs nothing and points at the exact span instead. Strings and comments are never touched.

24. Error codes

CodeMeaning
E0001this line is not valid Python or NME
E0101an end with no open block
E0102break outside a loop
E0103an else or elif with no open condition
E0104two else branches in one condition
E0105a block without its closing end
E0106return outside a function
E0107continue outside a loop
E0108yield outside a function
E0109await outside an async function
E0110yield from inside an async function
E0111async for outside an async function
E0112async with outside an async function
E0113nonlocal with no enclosing function
E0114star import outside module scope
E0115control flow inside an except* block
E0116yield inside a comprehension
E0117async comprehension outside an async function
E0118return value inside an async generator
E0119conflicting global declaration
E0120conflicting nonlocal declaration
E0201say value could not be understood
E0202the say expression is not valid
E0203the sentence to show is not valid
E0204say has nothing to show
E0211the question after the comma is missing
E0212the question could not be understood
E0213the ask target is not a variable name
E0221the value change could not be understood
E0222the break command could not be understood
E0223the skip command could not be understood
E0224the wait length could not be understood
E0225the list addition could not be understood
E0226the timer has not been started yet
E0301the condition is missing
E0302the condition could not be understood
E0303the repeated body could not be understood
E0304the repeat count could not be understood
E0305the repeat count is missing
E0306the repeat-over-a-list line could not be understood
E0401NME bundles use random and use file
E0402latest and an exact version on one line
E0403the module version is missing
E0404this module version is not bundled
E0405the module would overwrite your names
E0406the use line shape is not understood
E0411the value to save is missing
E0412the value to save could not be understood
E0413the name to save into is missing
E0414the save target is not a simple name
E0501the repeated block is not indented
E0502the condition needs a colon
E0503a block that starts without a statement
E0504one statement per line
E0505the block body is not a statement NME knows
E0601the sentence could mean more than one action
E0602no NME action was found on this line
E0701a sentence-style line across several physical lines
E0702the Python source is not valid
E9001unknown command
E9002modules takes no extra arguments
E9003an option is missing its value
E9004unknown option
E9005unexpected extra file
E9006convert needs a file
E9007a file could not be read
E9008a file could not be written
E9009refusing to overwrite the output
E9010the native compiler failed
E9011the native compiler could not be started
E9012CPython rejected the generated Python
E9013Python could not be started
E9014that is a folder, not a program
E9015the program file does not exist
E9016the current folder could not be read
E9017no .nme program in this folder
E9018the pick answer could not be read
E9019no pick answer given
E9020the pick answer is not a listed program
E9021the pick answer matches several programs
E9022several programs match this name
E9023the error lookup takes one code
E9024unknown error code
E9025pip could not install the package
E9026the native program could not be started
E9027a temporary working folder could not be created
E9028two imported modules have the same name
E9029module imports are not supported by nme compile
E9030the package name is missing
E9031-o is only available with nme native build
E9032more than one native action was given

Run nme en E0102 for the long explanation of a code (nme ko E0102 in Korean).

This page on GitHub