Lojban
The Logical Language
Log in
Username:
Password:
I forgot my password |
CapsLock is on.
Log in
History: Number subgrammar
View page
Show All Versions
Source of version: 7
«
»
For computer applications of Lojban, there needs to be a formal grammar of numbers. I started from ((xorxes))' grammar below, and revised it in places and made it into a ((PEG)) grammar. I intend to meet all the rules in chapter 18 of CLL, except the one where it contradicts Lojban for Beginners, and LfB has the more useful reading. Namely, you can have a decimal point inside a "digit" (segment) of a mixed-base number like a time. This involves defining 14 new selma'o. SA is not handled yet (what should it do inside a number?) Also, letters mixed with numbers are not handled, but I consider this a feature and not a bug. The "number" rule in the existing grammar is replaced, and these rules are inserted: ^digit <- NO / TUhO digits <- digit+ thousand <- digits? KIhO whole <- thousand+ digits? / digits approx <- whole / MAhU after-decimal <- whole? ( RAhE whole? / JIhI approx? )? approx-decimal <- (whole? PI)? approx decimal2 <- whole (PI after-decimal / JIhI approx-decimal)? / PAI decimal1 <- MAhU? decimal2 / MAhU decimal <- decimal1 CEhI? digitplace <- decimal PIhE? tuple <- digitplace+ real <- decimal / tuple / indef indef <- PI? RO / TUhO fraction <- real? FIhU fraction? / real complex <- fraction? KAhO fraction? / fraction quantity <- real / fraction / DAhA quantity range <- DAhA? SUhO quantity? number <- indef number / range+ / complex / quantity NO <- pre-cmavo NO-words post-cmavo NO-words <- "no" / "pa" / "re" / "ci" / "vo" / "mu" / "xa" / "ze" / "bi" / "so" / "dau" / "fei" / "gai" / "jau" / "rei" / "vai" / "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" MAhU <- pre-cmavo MAhU-words post-cmavo MAhU-words <- "ma'u" / "ni'u" SUhO <- pre-cmavo SUhO-words post-cmavo SUhO-words <- "su'e" / "su'o" / "me'i" / "za'u" TUhO <- pre-cmavo TUhO-words post-cmavo TUhO-words <- "tu'o" / "xo" PAI <- pre-cmavo PAI-words post-cmavo PAI-words <- "pai" / "te'o" / "ci'i" CEhI <- pre-cmavo CEhI-words post-cmavo CEhI-words <- "ce'i" KIhO <- pre-cmavo KIhO-words post-cmavo KIhO-words <- "ki'o" PI <- pre-cmavo PI-words post-cmavo PI-words <- "pi" PIhE <- pre-cmavo PIhE-words post-cmavo PIhE-words <- "pi'e" RAhE <- pre-cmavo RAhE-words post-cmavo RAhE-words <- "ra'e" RO <- pre-cmavo RO-words post-cmavo RO-words <- "ro" / "so'a" / "so'e" / "so'i" / "so'o" / "so'u" / "rau" / "du'e" / "mo'a" / "no'o" JIhI <- pre-cmavo JIhI-words post-cmavo JIhI-words <- "ji'i" KAhO <- pre-cmavo KAhO-words post-cmavo KAhO-words <- "ka'o" DAhA <- pre-cmavo DAhA-words post-cmavo DAhA-words <- "da'a" FIhU <- pre-cmavo FIhU-words post-cmavo FIhU-words <- "fi'u" ^ ''mi'e ((rab.spir))'' ----- I have reformulated my grammar somewhat in light of Rob's grammar and some further thought: ^number = quantifier | tuple quantifier = [[DAhA | SUhO] ... decimal CEhI | [[PI] quantity | [[quantity] FIhU quantity [[quantity] | quantity quantity quantity = (DAhA | SUhO) ... & (RO | CIhI | digits) tuple = complex & PIhE [[tuple] complex = fraction & KAhO [[complex] fraction = real & FIhU [[fraction] real = [[SUhO & MAhU] (decimal | CIhI) decimal = PAI | digits & PI (digits & RAhE digits) digits = NO... | TUhO New selma'o: NO = no | pa | re | ci | vo | mu | xa | ze | bi | so | dau | fei | gai | jau | rei | vai | ki'o RO = ro | so'a | so'e | so'i | so'o | so'u | no'o | rau | du'e | mo'a SUhO = su'o | su'e | me'i | za'u | ji'i DAhA = da'a TUhO = tu'o | xo MAhU = ma'u | ni'u FIhU = fi'u PI = pi RAhE = ra'e PAI = pai | te'o CIhI = ci'i KAhO = ka'o PIhE = pi'e CEhI = ce'i ^ !!!Notes: # I made ki'o a NO because it can mix with the digits in any combination. {ki'o} by itself means 1000, {ki'opa} is 1001, {reki'o} is {2000}, {ki'oreki'o} is {1002000}, etc. # I'm not completely sure how ki'o works with pi. {pipareciki'omu} is {.123,4}, but what happens when less than three digits are given before ki'o? I would guess {piki'ore} = .000,2 {piki'o} = .001 and {pireki'o} = .002 rather than .201 so that {ki'o} acts before {pi} to fill in zeroes. # I put {ci'i} in its own selma'o, because it can be a quantifier, whereas pai and te'o cannot. # I put {ji'i} with the SUhOs because it is also used to indicate a range. This means that I don't use the position of ji'i as an indicator of the magnitude of fuzziness. # I made ''fi'u'' bind closer than ''ka'o''. Either choice was possible. So ''cika'ovofi'umu'' is 3+i(4/5) and not (3+i4)/5. # 3/4/5 is 3/(4/5), and 3 + i4 + i5 is 3 + i(4+i5). # I allow fractions such as 3.5/2.7 ''mi'e ((xorxes))'' ----- *((tinkit)) try ((xei)) instead of rei. xo really should be an indef. oh, and what's the initial non-terminal?
History
Enable pagination
rows per page
HTML diff
Side-by-side diff
Side-by-side diff by characters
Inline diff
Inline diff by characters
Full side-by-side diff
Full side-by-side diff by characters
Full inline diff
Full inline diff by characters
Unified diff
Side-by-side view
HTML diff
Side-by-side diff
Advanced
Information
Version
Thu 15 of Jul, 2004 21:09 GMT
xorxes
from 200.49.74.2
11
Tue 13 of Jul, 2004 14:07 GMT
xorxes
from 200.49.74.2
9
Tue 13 of Jul, 2004 13:27 GMT
xorxes
from 200.49.74.2
8
Tue 13 of Jul, 2004 02:07 GMT
rab.spir
from 66.92.73.176
7
Sat 10 of Jul, 2004 19:52 GMT
xorxes
from 200.43.74.114
6
Fri 09 of Jul, 2004 18:53 GMT
rab.spir
from 66.92.73.176
5
Fri 25 of Jun, 2004 18:56 GMT
rab.spir
from 128.31.7.133
4
Mon 22 of Sep, 2003 19:52 GMT
admin
from admin
updated by the phpwiki import process
3
Fri 30 of Nov, 2001 12:31 GMT
admin
from admin
created from phpwiki import
2
Select action to perform with checked...
Remove
OK
About
Introduction
What Others Say
FAQ
Learning
Books
Vocabulary
Lojbanic Software
Community
Web/Email Forums
IRC Chat
Links
News
Dictionary
Swag
Multimedia
Lojbanic Texts
Audio
Wiki
Recent Changes
Popular Pages
How To Edit
The LLG
Official Projects
Publications
Donate!
Contact Us
Search Lojban Resources