Codifying Grammar

So rfindley let us about his programming technique for learning grammar: Codifying Grammar.

Writing code, with Japanese grammar…

Could it be a new programming language using Japanese grammar? Operators/Keywords become grammar… AND is と, OR is か, IF たとえば, etc.

Considering its use, it should be flexible to cover a decent amount of grammar.

What do you guys think his method could entails?

1 Like

Well there is Dolittle, a programming language that uses keywords based on Japanese.

カメ=タートル! 作る。
時計=タイマー! 作る 0.1秒 間隔 500回 回数。 時計! 「かめ太! 10 歩く」 実行。
左=ボタン!”左”作る。 左:動作=「かめ太! 20 左回り」。
右=ボタン!”右”作る。 右:動作=「かめ太! 10 右回り」。

I would assuming it’s going to be some sort of tool centered around grammar, not a language itself. For example @doncr has a neat conjugation drill thingy here:

I’m guessing by the time he’s done with this he’ll know the points so intimately he won’t even have a reason to use his own tool xD

Alternatively, would could always just @rfindley directly…

Why not start a language? Someone throw up an open source project and we can collaborate. We’ll probably learn a ton doing it.

Javascript allows Unicode for variable and function names, so you could actually write some very Japanesey code. I discovered this while unwrapping someone’s obfuscation engine a while back. But that’s not what I’m working on :grin:

@ccookf is correct. I’m writing code for processing grammar as part of a set of language-learning tools.

While doing the coding certainly helps me understand Japanese better, it doesn’t help me with fluency. So, I’ll definitely still be able to benefit from the finished product for that.

1 Like

You can also use Unicode for variables in Ruby and Python.

Just don’t use it in actual production code, please. :slight_smile:

Hah! I wish it worked like that. I know a helluva lot more about conjugation by writing that tool and some of it has stuck, but not all yet. I was surprised that only after a few sessions of using it myself that I started to know instinctively if a verb was ichidan / godan and I automatically chose the right conjugation without thinking about it.

1 Like

I tried something in Haskell, this could work.

と = (&&)
か = (||)

たよえば :: Bool -> a -> a -> a
たよえば cmp a b = if cmp then a else b

main :: IO ()
main = do
    たよえば (False `と` True)
        (print "true")
        (print "false")

One could probably do even more if he put some effort into that.

So my thoughts and my initial play (in JavaScript) has led me to try and model context information about actions, events and locations, etc. The aim for me would to be able to construct random scenarios and ask questions about them, by giving the information in Japanese sentences using appropriate particles, etc.

One end goal that I have in mind would be able to produce logic problems (e.g. like but in Japanese.

1 Like

This sounds like a much better way of pissing people off than passive aggressive commits. If anyone complains I could just respond with “kanban” and grin.

That sounds pretty awesome. There’s a pretty big gap for useful tools and practice material like this for self-study. Even just finding ways to reasonably slide more Japanese into daily life is helpful. I look forward to seeing what you pull off. Best of luck! :smiley:

1 Like

1 Like

As a DBA, this made me vomit a little in my mouth. >.>


In Python, I failed to add Japanese to the code, but may be I should be able to… by specifying the code as “unicode”.

Because that I failed that I switch to using Javascript, to avoid complexity of I/O.

In all of the editors I use, you normally specify the ‘encoding’ of the file. Many editors default to “ISO/IEC 8859-1”, which is essentially just ascii. If you want to support unicode, you can change the encoding to utf8.

If your editor doesn’t allow you to directly specify the encoding, but does have an option for ‘unicode’, then yeah… use that.

1 Like

Actually I mean, like this:

# -*- coding: utf-8 -*-

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.