Korean as a Concatenative, Stack-Oriented Language

Korean is an subject-object-verb (SOV) language, which shares the a similar structure to Reverse Polish Notation (RPN) used in concatenative, stack-oriented computer programming languages such as Forth and Factor. By this, I mean that SOV and RPN both have operators (i.e. verbs and adjectives, in the case of Korean) in the final position, which take the proceeding subject and object as arguments. In other words, SOV could be seen as (S,O)V where S and O are arguments to V. Similarly, nouns can take adjectives or even relative clauses as arguments, verbs take adverbs, particles take nouns, verb endings (어미) take verbs, etc. Taken further, this can be visualized as a concatenated list of values being pushed on and off of a stack like stack-oriented computer languages do when they are executing programs. I believe this stack analogy may be able to help some Korean (and other SOV) language learners better mentally parse sentences while reading.   This is surely not a perfect analogy and I do not claim this to be an original idea, but it was simply something I noticed when learning about the Factor language and drew parallels to the way Korean is structured.

Brief Introduction to RPN and Stacks

Like SOV languages, RPN puts the operator in the postfix position. This means that instead of saying 2 + 3, one would say 2 3 +. Taken further, instead of writing (2 + 3) × 11 + 1, one would say 2 3 add 11 mul 1 add as a concatenated list of symbols and operators. Since this can become cumbersome to keep track of mentally, it can be represented on a stack where inputs are pushed onto the stack and consume any existing values as arguments:

Input
2
3
add
11
mul
1
add
Stack
2
3
5
11
55
1
56
2
5
55

This is only meant to be a brief introduction, but Wikipedia goes into more depth with this example. Make sure you understand this concept before continuing onto the Korean examples below.

Basic Example

This is a basic example showing a simple sentence with a subject, object, and verb:

Original
내가 밥을 먹다. (I eat rice.)
Lexing

Breaking the original sentence into concatenated, parameterized morphemes:

나 (N)가 밥 (N)을 (S,O)먹 (V)다.

Notice how not only does the verb have parameters, but also the particles and verb ending. I'm viewing the particles as almost like optional, type-safe wrappers to mark the subject and verb. Without them, the types can be inferred, but they add clarity a sort of type-safety. The verb endings are also parameterized in a similar way, but these take verbs and return new verbs for multiple levels of chaining (i.e. agglutination).

Parsing

Moving left-to-right, each morpheme is added to the stack. Some morphemes can consume morphemes already on the stack as arguments similar to the math example above.

Input

(N)가

(N)을
Stack

(나)가

(밥)을



(나)가
(나)가
Input
(S,O)먹
(V)다
Stack
((나)가, (밥)을)먹
(((나)가, (밥)을)먹)다
Relative Clause Example

This is a slightly more complex example showing how relative clause is treated, which is often one of sources of difficulty for Korean learners, especially those coming from SVO languages like English. This also includes past tense and a polite verb ending.

Original
어제 먹은 음식이 맛있었어요. (The food I ate yesterday was delicious.)
Lexing
어제 먹 (V)은 음식 (N)이 (S)맛 (S)있 (V)었 (V)어요.
Parsing

Same as the example above, but some morphemes consume optional parameters. They are not part of the signature shown in the lexing because they are not required, and listing every possible optional parameter would be impractical. An example of this is a verb being described by an adverb. A verb can certainly take an adverb, but it is not required. A transitive verb on the other hand would be required to take an object, even if it might be an implied object.

Note how the relative clause 어제 먹은 simply acts as a descriptor to 음식. This is a simple relative clause for brevity, but it's easy to see how this could be expanded.

Input
어제

(V)은
음식
(N)이
Stack
어제
(어제)먹
((어제)먹)은
(((어제)먹)은)음식
((((어제)먹)은)음식)이
Input
(S)맛
(S)있
(V)었
(V)어요
Stack
(((((어제)먹)은)음식)이)맛
((((((어제)먹)은)음식)이)맛)있
(((((((어제)먹)은)음식)이)맛)있)었
((((((((어제)먹)은)음식)이)맛)있)었)어요
Conclusion

As mentioned above, this is only scratching the surface, but it could be taken further although there are surely holes in places like conditionals, topics, and contextual information. For example conditionals (e.g. -면) probably need to be treated as infix operators and topics and contextual information could probably be envisioned living in their own stack alongside the main sentence stacks shown above.

I also considered creating an extension to Factor (or perhaps a whole new programming language) that was based on Korean keywords following this principle. It's not really a task I would like to take on now, but perhaps someone would like to run with the idea on their own.

By Ryan Brainard