context free grammars: Difference between revisions

From Lojban
Jump to navigation Jump to search
m (Text replace - "{BOX()} " to "")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
aka CFG, a grammar which rules do not depend on the context during parsing. I know, this is a circular definition.


 
Here are some examples :
===  cmavo: ca'u (FAHA2) ===
* Lojban grammar, and more generally any [[LR]] or [[LL]] grammar, are context-free.
 
* The C language is supposed to be context-free, except on the topic of type definition (if "typedef" preceeds a definition, the symbol defined becomes a type rather than a variable : semantics change depending on the context, given the same lexical grammar).
====  Proposed Definition ====
** C is fairly good about it, compared to many other languages.
 
* English is not context-free. The way we parse/understand sentences depends on the context, either past or future. Consider this text:
Indicates that something is positioned in front of the speaker.  When tagging a sumti, indicates that the relation described by the bridi in question is positioned in front of the tagged sumti.
{{mu||you if sense makes sentence this, please read the first six words backwards.}}
 
==Discussion==
====  Proposed Tag ====
*cein:
 
**Doesn't Lojban have '''si/sa/su''', which must be "understood" by the parser in the same sense as the English example above in order to be correctly parsed?
farna tcita (provisional)
*** maybe this doesn't address what you mean - but '''si/sa/su''' can be implemented below actual language parsing, similar to \ line continuations in C.
 
*** they are trivially handled by the lexer.
====  See Also ====
*But this sentence isn't legitimate English...
 
**.djorden.:
* {crane}
***Arguable. But the point still stands - English isn't context freeA phrase structure grammar for English would be hideously large and type 0-1, if a complete one were ever made, which is unlikely.
* {farna}
*[[User:And Rosta|And Rosta]]:
 
**I thought a CFG was one where the left side of the rewrite rule is unconditional. E.g. "A -> B C" is context free, but "A -> B C, when A is preceded by D" ("D A -> B C") is not context free.
====  Proposed Keywords ====
*[[Jay Kominek|Jay]]:
 
**Fairly sure that is the case. It would certainly be context.
* front
*.djorden.:
* in front of
**The above is correct - a context free grammar may only have one non terminal on the left hand side of its rules.
 
* forwards
* to the front of
 
====  Usage Examples ====
 
;dy co'a klama gi'e gunta le ca'u pa moi be la molki:D started going and attacked the front-most mill.
 
;lo jukni ca'a dinju gasnu ca'u le mi skami jarco:A spider is actually building a web in front of my computer screen.
 
====  Notes ====
 
"dinju" is not normally "web"; this is inferred from context because
 
it's a spider making it.
 
{BOX}
 
 
===  cmavo: ga'u (FAHA2) ===
 
====  Usage Examples ====
 
;xu do terdu'a le dakfu le tolci'o nanmu ga'u le jacfa'u:Have you gotten the sword from the old man above the waterfall?
 
;mi ga'u lo ba'e tolxanri bloti cu co'e:On top of the boat, I do something.
 
;ma pu ga'u muvdu:What moved above you?
 
====  Proposed Definition ====
 
Indicates that something is positioned above the speaker.  When tagging a sumti, indicates that the relation described by the bridi in question is positioned above the tagged sumti.
 
====  Proposed Tag ====
 
farna tcita (provisional)
 
====  See Also ====
 
* {gapru}
* {farna}
 
====  Proposed Keywords ====
 
* above
* upwards
 
* up from
 
{BOX}
 
 
===  cmavo: ni'a (FAHA2) ===
 
====  Proposed Definition ====
 
Indicates that something is positioned below the speaker.  When tagging a sumti, indicates that the relation described by the bridi in question is positioned below the tagged sumti.
 
====  Proposed Tag ====
 
farna tcita (provisional)
 
====  See Also ====
 
* {cnita}
* {farna}
 
====  Proposed Keywords ====
 
* below
* downwards
 
* down from
 
====  Usage Examples ====
 
;mi kakne lo nu reskla ni'a le vrogai:I can creep under the door.
 
;ko mo'i ni'a klama fo le serti:Go down the stairs.
 
{BOX}
 
 
===  cmavo: ri'u (FAHA2) ===
 
====  Proposed Definition ====
 
Indicates that something is positioned to the right of the speaker.  When tagging a sumti, indicates that the relation described by the bridi in question is positioned to the right of the tagged sumti.
 
====  Proposed Tag ====
 
farna tcita (provisional)
 
====  See Also ====
 
* {pritu}
* {farna}
 
====  Proposed Keywords ====
 
* on the right of
* rightwards
 
* to the right of
 
====  Usage Examples ====
 
;le zu'a nanmu mo'i ri'u klama:The man to my left goes to my rightwards.
 
;lo skami be ri'u mi cu co'u cladu:The computer to my right stopped being loud.
 
;la .bil. sanli ri'u vi ku:Bill stands nearby to my right.
 
;lo tadni cu zu'a nanmu gi'e ri'u ninmu:The students are women on my left and men on my right.
 
{BOX}
 
 
===  cmavo: ru'u (FAHA2) ===
 
====  Proposed Definition ====
 
Indicates that something is wrapped around of the speaker.  When tagging a sumti, indicates that the relation described by the bridi in question is wrapped around the tagged sumti.
 
====  Proposed Tag ====
 
farna tcita (provisional)
 
====  See Also ====
 
* {sruri}
* {farna}
 
====  Proposed Keywords ====
 
* surrounding
* annular
 
* around
 
====  Usage Examples ====
 
;mi mutce le ka tatpi le nu ru'u limna:I am very tired of swimming about here.
 
;.a bu tengau le birka ru'u le gumri:Alice stretched her arms around the the mushroom.
 
====  Notes ====
 
Does this work like sruri, which has "near total containment in some dimension(s)" in the notes?
 
The ru'u limna example seems like it doesn't work, because Alice herself is not wrapped around anything.
 
Is this word actually ''useful'' for much of anything.
 
{BOX}
 
 
===  cmavo: ti'a (FAHA2) ===
 
====  Proposed Definition ====
 
Indicates that something is positioned behind of the speaker.  When tagging a sumti, indicates that the relation described by the bridi in question is positioned ... of the tagged sumti.
 
====  Proposed Tag ====
 
farna tcita (provisional)
 
====  See Also ====
 
* {trixe}
* {farna}
 
====  Proposed Keywords ====
 
* behind
* rearwards
 
* to the rear of
 
====  Usage Examples ====
 
;lo zgike sance cu klama fi lo rictu'a be ti'a le mi zdani:The musical sounds came from the forest behind my house.
 
;.ii sai ko viska ti'a do:Look out behind your!
 
;vy ti'a jgari sy re birka le cutne:V hugged S from behind.
 
{BOX}
 
 
=== cmavo: zu'a (FAHA2) ===
 
====  Proposed Definition ====
 
Indicates that something is positioned to the left of the speaker.  When tagging a sumti, indicates that the relation described by the bridi in question is positioned to the left of the tagged sumti.
 
====  Proposed Tag ====
 
farna tcita (provisional)
 
====  See Also ====
 
* {zunle}
* {farna}
 
====  Proposed Keywords ====
 
* on the left of
* leftwards
 
* to the left of
 
====  Usage Examples ====
 
;lo tadni cu zu'a nanmu gi'e ri'u ninmu:The students are women on my left and men on my right.
 
;le zu'a nanmu mo'i ri'u klama:The man to my left goes to my rightwards.
 
{BOX}
 
===  General Section Issues ===
 
Most of these make no sense in front of a selbri with "mi" in the
 
bridi, because you can't be (for example) above yourself, so "mi
 
ga'u zutse" doesn't seem possible.
 
Does "ri'u do" mean "on your right", or "rightwards of you relative to the speaker"? Whichever it means, we need a way to say the other without leaving tenses.
 
* I would think {ri'u do} would be the latter, while {do ri'u} is the former. - .aionys.

Latest revision as of 14:40, 1 July 2015

aka CFG, a grammar which rules do not depend on the context during parsing. I know, this is a circular definition.

Here are some examples :

  • Lojban grammar, and more generally any LR or LL grammar, are context-free.
  • The C language is supposed to be context-free, except on the topic of type definition (if "typedef" preceeds a definition, the symbol defined becomes a type rather than a variable : semantics change depending on the context, given the same lexical grammar).
    • C is fairly good about it, compared to many other languages.
  • English is not context-free. The way we parse/understand sentences depends on the context, either past or future. Consider this text:
you if sense makes sentence this, please read the first six words backwards.

Discussion

  • cein:
    • Doesn't Lojban have si/sa/su, which must be "understood" by the parser in the same sense as the English example above in order to be correctly parsed?
      • maybe this doesn't address what you mean - but si/sa/su can be implemented below actual language parsing, similar to \ line continuations in C.
      • they are trivially handled by the lexer.
  • But this sentence isn't legitimate English...
    • .djorden.:
      • Arguable. But the point still stands - English isn't context free. A phrase structure grammar for English would be hideously large and type 0-1, if a complete one were ever made, which is unlikely.
  • And Rosta:
    • I thought a CFG was one where the left side of the rewrite rule is unconditional. E.g. "A -> B C" is context free, but "A -> B C, when A is preceded by D" ("D A -> B C") is not context free.
  • Jay:
    • Fairly sure that is the case. It would certainly be context.
  • .djorden.:
    • The above is correct - a context free grammar may only have one non terminal on the left hand side of its rules.