News for hackers. Stuff that matters.
Re:Japanese Grammar in EBNF notation by euske on Sunday January 05, 2020 @01:40AM (#21960058)
Their grammar lacks the crucial component that is the recursive structure of natural languages, which was originally pointed by Chomsky, et al.

Here's how I (Japanese native) would do it:

  SENTENCE = S 。
  S = BUN* verb | BUN* NP be-verb
  BUN = NP pp | adv  (pp = postposition, or 助詞) 
  NP = noun | adj NP | S NP
Warning: this is a highly simplistic version. But this way, things like "今日 築地 で 寿司 を 食った 。 (Today Tsukiji [place-mark] sushi [object-mark] ate .)" could be parsed as follows:

  (S (BUN (adv 今日))
     (BUN (NP (noun 築地)) (pp で))
     (BUN (NP (noun 寿司)) (pp を))
     (verb 食った)) 。
Then, this can be further extended to a compound sentence: "築地 で 食った 寿司 は うまい 寿司 だった 。 (Tsukiji [place-mark] ate sushi [subject-mark] good sushi was .)"

  (S (BUN (NP (S (BUN (NP (noun 築地)) (pp で))
                 (verb 食った))
              (NP (noun 寿司))) (pp は))
     (NP (adj うまい)
         (NP (noun 寿司)))
     (be-verb だった)) 。
p.s. Yoda has nothing to do with this grammar.
Re:Japanese Grammar in EBNF notation by mikekchar on Sunday January 05, 2020 @01:57AM (#21960085)
My (non-native) criticism :-)

The be-verb is optional in S. "S = NP" is completely valid grammatically. Also "adj = BUN* verb | B* NP be-verb" if you allow "i-adjectives" to be classed as verb phrases (as they were historically) and "na-adjectives" to be "noun-phrase ni aru". So you would actually get:

  SENTENCE = VP | NP
  VP = BUN* verb | BUN* NP be-verb
  BUN = NP pp | adv
  NP = VP? noun
I'm also not sure about the fact that "adv NP be-verb" is allowed by this grammar...

Edit: spelling

Re:Japanese Grammar in EBNF notation by tasogare on Sunday January 05, 2020 @04:08AM (#21960422)
Yes, that’s my criticism as well: a single adj category has no meaning because there is two of adjectives in Japanese, one with verbal trait, the other acting more like nouns. The difference can and needs to be addressed in a grammar.

The grandparent point about recursive rule(s) is valid however and their easiness is one of my favorite things in Japanese grammar.

Anyway, the problem seems easy at first but it’s totally possible to vaste hours perfecting a grammar that still doesn’t capture frequently occurring construction (been there done that).

Re:Japanese Grammar in EBNF notation by jotakami on Sunday January 05, 2020 @08:02AM (#21961078)
The original article mentions something that I wish I had known when I began learning Japanese ~20 years ago: there aren’t really adjectives in Japanese, just nouns and verbs which have a few different inflection rules. Generally, any noun or verb (phrase) can modify another so there’s no need to create a separate category called adjective.
Re:Japanese Grammar in EBNF notation by samatman on Sunday January 05, 2020 @11:28AM (#21961975)
This is substantially true of English as well; we can construct a grammatically valid phrase such as "the sleepy gorillaesque lamppost".

With, of course, some exceptions. I'm confident there are exceptions in Japanese as well, being as exceptions are the rule in natural languages.

Re:Japanese Grammar in EBNF notation by resoluteteeth on Sunday January 05, 2020 @10:59AM (#21961812)
You can think of them as verb-like adjectives and noun-like adjectives, or you can think of them as adjective-like verbs and adjective-like nouns, but it really makes no difference one way or the other, and either way they are going to be their own separate categories.
Re:Japanese Grammar in EBNF notation by glandium on Sunday January 05, 2020 @08:25AM (#21961139)
... except for the fact that 形容詞 (i-adjectives) and 形容動詞 (na-adjectives) are used differently from 名詞 (nouns) and 動詞 (verbs). So there needs to be some distinction at some point, even if at the high level, 名詞 and 形容動詞 are similarish, and 形容詞 and 動詞 are similarish. But that doesn't go beyond -ish, and it's important to know.
Re:Japanese Grammar in EBNF notation by ngcc_hk on Sunday January 05, 2020 @02:14AM (#21960129)
Thanks and using lisp or list structure help quite a bit.
Re:Japanese Grammar in EBNF notation by bsza on Sunday January 05, 2020 @03:07AM (#21960244)
I fail to see how your example goes beyond the "boring" version.

モンタナにいるひとはうつくしいひとだ。

This sentence is accepted by the parser shown in the article and is conceptually the same as 「築地 で 食った 寿司 は うまい 寿司 だった 。」 (save for the use of past tense, which, for this purpose, is irrelevant).

Re:Japanese Grammar in EBNF notation by yorwba on Sunday January 05, 2020 @07:12AM (#21960937)
The grammar in the article would parse your example as

  (S (JAR (noun-no モンタナ) (LID に))
     (JAR (M (verb-u いる)) (noun-no ひと) (LID は))
     (SFF (M (verb-i うつくしい)) (noun-no ひと) (da だ)))
Note how Montana is at the same level of nesting as everything else, rather than being part of the modifier describing the person.

The parser just turns every sentence into a flat list. Imagine a parser for a programming language that parses every single line, but doesn't group lines in the same function, loop, conditional etc. together. Unless the language is assembly, you wouldn't be able to get away with that.

Re:Japanese Grammar in EBNF notation by bsza on Sunday January 05, 2020 @08:27AM (#21961144)
Very good observation. I didn't pay attention to nesting. It didn't even occur to me that this interpretation of the sentence was also possible. (And as far as I can tell it's is a perfectly valid interpretation too!)

It all comes down to the precedence levels of the LID particles (に, は, で etc.), doesn't it. I'm not sure if those are well-defined, but I think it would feel more natural for a native speaker to evaluate に before は in nearly all cases. The order between で and は seems more elusive. I'll definitely bring this up in our conversation group next time, though I'm sure I'll get some funny looks for it.

Re:Japanese Grammar in EBNF notation by glandium on Sunday January 05, 2020 @08:58AM (#21961255)
I don't see this as a case of precendence.of に vs は but rather as a case of に being associated with いる, and that without it, いる人 is incomplete.
Re:Japanese Grammar in EBNF notation by bsza on Sunday January 05, 2020 @10:20AM (#21961581)
いる人 by itself means "a person who exists". Not something that would come up in everyday speech, but the grammar checks out, I think. Might sound more natural to replace いる人 with 生きてる人 though.
Re:Japanese Grammar in EBNF notation by sova on Sunday January 05, 2020 @02:15PM (#21963238)
I believe the nesting you wish can be realized by an addition to the Modifier rule, allowing modifiers to be complete Jars:

    M = Jar | verb-u | verb-i | noun-na na | noun-no no