Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Are DF raws regular?  (Read 1118 times)

Sizik

  • Bay Watcher
    • View Profile
Are DF raws regular?
« on: July 26, 2012, 11:57:55 am »

That is, are they a regular language? Or are they context-free, or even more complex? Some types of raws definitely are less complex than others, such as the language raws, which definitely look to be regular.

Disregard the fact that many raw types refer to tokens defined in other files (such as materials and body parts), we'll assume that any appropriate value for those is valid.
Logged
Skyscrapes, the Tower-Fortress, finally complete!
Skyscrapes 2, repelling the zombie horde!

MrWiggles

  • Bay Watcher
  • Doubt Everything
    • View Profile
Re: Are DF raws regular?
« Reply #1 on: July 26, 2012, 12:02:46 pm »

I think the raws are pretty regular. They have a pretty decent fiber in their diet.
Logged
Doesn't like running from bears = clearly isn't an Eastern European
I'm Making a Mush! Navitas: City Limits ~ Inspired by Dresden Files and SCP.
http://www.bay12forums.com/smf/index.php?topic=113699.msg3470055#msg3470055
http://www.tf2items.com/id/MisterWigggles666#

Mr S

  • Bay Watcher
    • View Profile
Re: Are DF raws regular?
« Reply #2 on: July 26, 2012, 12:05:57 pm »

I see what you did there.  And I approve.
Logged

GreatWyrmGold

  • Bay Watcher
  • Sane, by the local standards.
    • View Profile
Re: Are DF raws regular?
« Reply #3 on: July 26, 2012, 12:14:53 pm »

I think the raws are pretty regular. They have a pretty decent fiber in their diet.
Ugh...

That is, are they a regular language? Or are they context-free, or even more complex? Some types of raws definitely are less complex than others, such as the language raws, which definitely look to be regular.

Disregard the fact that many raw types refer to tokens defined in other files (such as materials and body parts), we'll assume that any appropriate value for those is valid.
Well, enough things in most of the raw files are context-sensitive (e.g, caste-level tags, some reaction tokens) that the raws as a whole aren't regular. However, I have almost no clue as to what regular languages are because the Wikipedia definition seems to require knowledge of several other linguistic concepts.
Logged
Sig
Are you a GM with players who haven't posted? TheDelinquent Players Help will have Bay12 give you an action!
[GreatWyrmGold] gets a little crown. May it forever be his mark of Cain; let no one argue pointless subjects with him lest they receive the same.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Are DF raws regular?
« Reply #4 on: July 26, 2012, 02:21:11 pm »

I don't think so--positioning is almost entirely arbitrary, most any token can go wherever it wants to be, castes muck it up a bunch, there are too many references to other files, and, like many other programming languages, whitespace don't mean shit.

expwnent

  • Bay Watcher
    • View Profile
Re: Are DF raws regular?
« Reply #5 on: July 26, 2012, 04:23:13 pm »

I am pleasantly surprised that you are asking what I thought you were asking.

It depends on how you ask. Strictly speaking, the set of raw files that will not be ignored by DF or cause error messages in DF is not regular. For example, if you have an interaction that turns you into a creature or caste that does not exist, then it will cause an error message. The name of a creature or caste (DWARF, ELF, COLOSSUS_BRONZE, etc) can be arbitrarily long, and a DFA cannot remember the entire thing, and thus cannot know for certain whether that creature exists or not. Technically this makes them not even context-free, because the set of all strings of the form {x x} where x is some string is not context-free.

Ignoring such issues, and looking at the raws, I'm surprised to say that I think most of it is regular. There are finitely-many tags, numbers are not an issue, and there are finitely-many "contexts", such as defining a creature, listing something like

Code: [Select]
[TL_COLOR_MODIFIER:IRIS_EYE_AMBER:1:IRIS_EYE_AQUA:1:IRIS_EYE_AQUAMARINE:1:IRIS_EYE_ASH_GRAY:1:IRIS_EYE_AUBURN:1:IRIS_EYE_AZURE:1:IRIS_EYE_BLUE:1:IRIS_EYE_BRASS:1:IRIS_EYE_BRONZE:1:IRIS_EYE_BROWN:1:IRIS_EYE_CERULEAN:1:IRIS_EYE_CHESTNUT:1:IRIS_EYE_CHOCOLATE:1:IRIS_EYE_CINNAMON:1:IRIS_EYE_COPPER:1:IRIS_EYE_DARK_BLUE:1:IRIS_EYE_DARK_BROWN:1:IRIS_EYE_DARK_CHESTNUT:1:IRIS_EYE_DARK_GREEN:1:IRIS_EYE_DARK_OLIVE:1:IRIS_EYE_DARK_TAN:1:IRIS_EYE_ECRU:1:IRIS_EYE_EMERALD:1:IRIS_EYE_FERN_GREEN:1:IRIS_EYE_GRAY:1:IRIS_EYE_GREEN:1:IRIS_EYE_JADE:1:IRIS_EYE_LIGHT_BLUE:1:IRIS_EYE_LIGHT_BROWN:1:IRIS_EYE_MAHOGANY:1:IRIS_EYE_MIDNIGHT_BLUE:1:IRIS_EYE_OCHRE:1:IRIS_EYE_OLIVE:1:IRIS_EYE_PALE_BLUE:1:IRIS_EYE_PALE_BROWN:1:IRIS_EYE_PALE_CHESTNUT:1:IRIS_EYE_PERIWINKLE:1:IRIS_EYE_PINE_GREEN:1:IRIS_EYE_RAW_UMBER:1:IRIS_EYE_RUSSET:1:IRIS_EYE_SEA_GREEN:1:IRIS_EYE_SEPIA:1:IRIS_EYE_SKY_BLUE:1:IRIS_EYE_SLATE_GRAY:1:IRIS_EYE_SPRING_GREEN:1:IRIS_EYE_TAN:1:IRIS_EYE_TAUPE_DARK:1:IRIS_EYE_TAUPE_GRAY:1:IRIS_EYE_TAUPE_MEDIUM:1:IRIS_EYE_TAUPE_PALE:1:IRIS_EYE_TAUPE_SANDY:1:IRIS_EYE_TEAL:1:IRIS_EYE_TURQUOISE:1]
etc.

That being said, if you really want to parse them, you'd probably have a much easier time of it if you do it in a context-free way.
Logged