Assembly: a little bit more

Well, I’m back. Instead of giving you more apologies for missing a couple of weeks of this exciting series (sarcasm alert!), let’s jump right back in and look at some more old-school assembly language. This week, we’ll get to know homebrewed 6502 versions of a couple of C standard library staples, and we can start talking about how you use data structures in assembly.

Memory and data

The simplest, dumbest (for the computer, not the programmer) way to treat data is as raw memory. The problem is, there’s not much you can do with it. You can initialize it, copy it around, and that’s about it. Everything else needs some structure. Copying in assembly language is pretty easy, though, even in 6502-land:

; Arguments:
; $F0-$F1: Source address
; $F2-$F3: Destination address
; Y register: Byte count
memcpy:
    lda ($F0), Y    ; 2 bytes, 5 cycles
    sta ($F2), Y    ; 2 bytes, 6 cycles
    dey             ; 1 byte, 2 cycles
    bne memcpy      ; 2 bytes, 2-3 cycles
    rts             ; 1 byte, 6 cycles

Yep, this is a stripped-down version of memcpy. It has its limitations—it can only copy a page of memory at a time, and it has no error checking—but it’s short and to the point. Note that, instead of a prose description of the subroutine’s arguments and return values and whatnot, I’m just putting that in the comments before the code. I trust that you can understand how to work with that.

Since the code is pretty self-explanatory, the comments for each line show the size and time taken by each instruction. A little bit of addition should show you that the whole subroutine is only 8 bytes; even on modern processors, the core of memcpy isn’t exactly huge.

The timing calculation is a little more complex, but it’s no less important on a slow, underpowered CPU like the 6502. In the case of our subroutine, it depends on how many bytes we’re copying. The core of the loop will take 13 cycles for each iteration. The branch instruction is 3 cycles when the branch is taken, 2 cycles when it’s missed. Altogether, copying n bytes takes 16n+5 cycles, a range of 21 to 4101. (A zero byte count is treated as 256.) In a modern computer, four thousand cycles would be a few microseconds at most. For the 6502, however, it’s more like a few milliseconds, but it’s hard to get faster than what we’ve got here.

Strings

The first way we can give structure to our data is with strings. Particularly, we’ll look at C-style strings, series of bytes terminated by a null value, hex $00. One of the first interesting operations is taking the string’s length—the C standard library’s strlen—and this is one implementation of it in 6502 assembly:

; Arguments:
; $F0-$F1: String address
; Returns:
; A: Length of null-terminated string
strlen:
    ldy #$00        ; 2 bytes, 2 cycles
    clv             ; 1 byte, 2 cycles
  slloop:
    lda ($F0), Y    ; 2 bytes, 5 cycles
    beq slend       ; 2 bytes, 2-3 cycles
    iny             ; 1 byte, 2 cycles
    bvc slloop      ; 2 bytes, 3 cycles
  slend:
    tya             ; 1 byte, 2 cycles
    rts             ; 1 byte, 6 cycles

All it does is count up through memory, starting at the pointed-to address, until it reaches a zero byte. When it’s done, it gives back the result in the accumulator. Now, this comes with an obvious restriction: our strings can’t be more than 255 bytes, or we get wraparound. For this example, that’s fine, but you need to watch out in real code. Of course, in modern processors, you’ll usually have at least a 32-bit register to work with, and there aren’t too many uses for a single string of a few billion bytes.

Our assembly version of strlen weighs in at 12 bytes. Timing-wise, it’s 12n+20 cycles for a string of length n, which isn’t too bad. The only real trickery is abusing the overflow flag to allow us an unconditional branch, since none of the instructions this subroutine uses will affect it. Using a simple JMP instruction is equivalent in both time and space, but it means we can’t relocate the code once it has been assembled.

Another common operation is comparing strings, so here’s our version of C’s strcmp:

; Arguments:
; $F0-$F1: First string
; $F2-$F3: Second string
; Returns comparison result in A:
; -1: First string is less than second
; 0: Strings are equal
; 1; First string is greater than second
strcmp:
    ldy #$00        ; 2 bytes, 2 cycles
  scload:
    lda ($F0), Y    ; 2 bytes, 5 cycles
    cmp ($F2), Y    ; 2 bytes, 5 cycles
    bne scdone      ; 2 bytes, 2-3 cycles
    iny             ; 1 byte, 2 cycles
    cmp #$00        ; 2 bytes, 2 cycles
    bne scload      ; 2 bytes, 2-3 cycles
    lda #$00        ; 2 bytes, 2 cycles
    rts             ; 1 byte, 6 cycles
  scdone:
    bcs scgrtr      ; 2 bytes, 2-3 cycles
    lda #$FF        ; 2 bytes, 2 cycles
    rts             ; 1 byte, 6 cycles
  scgrtr:
    lda #$01        ; 2 bytes, 2 cycles
    rts             ; 1 byte, 6 cycles

Like the its C namesake, our strcmp doesn’t care about alphabetical order, only the values of the bytes themselves. The subroutine uses just 24 bytes, though, so you can’t ask for too much. (Timing for this one is…nontrivial, so I’ll leave it to the more interested reader.)

Other structures

Arrays, in theory, would work almost like strings. Instead of looking for null bytes, you’d have an explicit count, more like newer C functions such as strncmp. On the 6502, the indirect indexed addressing mode (e.g., LDA ($F0), Y) we’ve used in every example so far is your main tool for this. Other architectures have their own variations, like the x86’s displacement mode.

More complex structures (like C structs or C++ classes), are tougher. This is where the assembly programmer needs a good understanding of how high-level compilers implement such things. Issues like layout, padding, and alignment come into play on modern computers, while the 6502 suffers from the slower speed of indirection.

Self-contained structures (those that won’t be interfacing with higher-level components) are really up to you. The most common layout is linear, with each member of the structure placed consecutively in memory. This way, you’re only working with basic offsets.

But there’s a problem with that, as newer systems don’t really like to access any old byte. Rather, they’ll pull in some number of bytes (always a power of 2: 2, 4, 8, 16, etc.) all at once. Unaligned memory accesses, such as loading a 32-bit value stored at memory location 0x01230001 (using x86-style hex notation) will be slower, because the processor will want to load two 32-bit values—0x01230000 and 0x01230004—and then it has to do a little bit of internal shuffling. Some processors won’t even go that far; they’ll give an error at the first sign of an unaligned access.

For both of these reasons, modern languages generate structures with padding. A C struct containing a byte and a 32-bit word (in that order), won’t take up the 5 bytes you’d expect. No, it’ll be at least 8, and a 64-bit system might even make it 16 bytes. It’s a conscious trade-off of size for speed, and it’s a fair trade in these present days of multi-gigabyte memory. It’s not even that bad on embedded systems, as they grow into the space occupied by PCs a generation ago.

Coming up

For now, I think I’m going to put this series on hold, as I’m not sure where I want it to go. I might move on to a bigger architecture, something like the x86 in its 16-bit days. Until then, back to your regularly scheduled programming posts.

Writing The One

Many movies, books, and other works of fiction involve a protagonist who is destined (or fated or whatever other term you choose) to save the world. Only he (or she, but this is rarer) can do this. No one else has the power, or the will, or the knowledge necessary to accomplish this feat. But this character does, for some reason. He is The One.

Stories of The One aren’t hard to find. For example, Neo, in The Matrix, is explicitly referred to by that moniker. But the idea of a single savior of the world, someone who can do what no other person can, goes back centuries, if not more. After all, it’s the founding idea of Christianity. Perhaps that’s why it’s so embedded in the Western mind.

Writing a story about The One is fairly straightforward, but there are pitfalls. The most obvious is similarity: how do you distinguish your hero from all those who have come before? That part’s up to you, and it’s so dependent on your specific story that I’m not sure I can say much that would be relevant. However, I can offer some food for thought on the general notion of The One.

Begin at the beginning

Let’s start with the origin story, since that’s what is so popular these days. How did your One come about? More importantly, how did he gain that status? Here are a few ideas:

  • The One was born that way. This one works best when it’s fate driving the story. The One is somehow marked from birth as such. Maybe he was born in a time of omen, like an eclipse. Or he could be the child of a supernatural being. In any event, this kind of story can deal with the conflict inherent in growing up as The One. Another option is that The One’s status is fixed at birth, but his power comes later.

  • The One received the destined status at a certain time. This could be at a coming of age (18 years old or the cultural equivalent), or at the time of a particular event. Basically, this idea is just a delayed form of the one above, and most of the same caveats apply. The benefit is that you don’t have to write a story about a character growing both physically and metaphysically at the same time.

  • Something changed the course of fate. In other words, The One wasn’t always meant to be; he only came into his own after a specific event. The death of his parents, for example, or a plague ravaging his homeland. Or, perhaps, he finds a sage or a sword or whatever, setting him on the path of becoming The One. Before that, he was a kid on a farm or something like that. Clearly, in this case, some part of your story needs to tell that story, whether through a prologue, a series of flashbacks, or some other storytelling device. (Another option, if you’re making a trilogy or similar multi-part story, is to have the first “act” tell the protagonist’s origin.)

Method to the madness

Now we have another question: how does The One work? Rather, how does his status manifest itself? Jesus could work miracles. Neo had essentially godlike powers while he was in the Matrix. Luke Skywalker was simply more powerful and more adept at the Force. None of these are wrong answers, of course; the one you want largely depends on the goal of your story. Some options include:

  • All-powerful, all the time. Sometimes The One really does have the power of a deity. That can work for movies, and even for books. It’s harder for a video game, though, and it can be tricky in any medium. The hardest part is finding a way to challenge someone who has such a vast amount of power. Look to superheroes, especially overpowered ones like Superman and Thor, for ideas here. (If this kind of The One gains his powers after a life-changing event, then you have a nice, neat solution for the first part of your story.)

  • Increasing over time. This one is popular in fantasy literature and video games, mostly because it fits the progression model of RPGs. If you’ve ever played a game where you slowly “level up” as the story unfolds, then you know what’s going on here. Either The One grows in overall strength, or his powers gradually unlock. Both ways can work, but a non-game needs to be written so that it doesn’t seem too “gamey”.

  • Unlocking your full potential. Instead of a slow rise in power, it’s also possible that The One’s path follows a pattern more like a staircase. Here, pivotal events serve to mark the different “stages” to The One. In actuality, this is another way of leveling up, but it’s guided by the story. The final confrontation (or whatever would end the world, if not for The One) is then the final level, and drama dictates that this is when the protagonist would reach the apex of his ability—probably shortly after a failure or setback.

Supporting cast

The One isn’t always alone. Any proper world-saving hero is going to have a set of helpful allies and companions. By necessity, they won’t be as powerful, but they can each help in their own way. Almost any type of character works here, as long as they can fade a little bit into the background when it’s time for The One to take center stage. Here are some of the more common ones.

  • The love interest. It’s a given nowadays that a hero needs romance. In video games, the current fad is to let the player choose which character gets this role. For less interactive works, it’s obviously a fixed thing. Whoever it is, the point is to give the hero someone to love, someone who is utterly dependent on his success, in a more personal way than the rest of the world.

  • The childhood friend. This is another way to add a personal element to the catastrophe. Like the love interest (which can actually be the same person), the childhood friend “grounds” The One in reality, giving a human side to someone who is by definition, a superhuman. (Note that you can also substitute a family member here, but then you can’t really combine this role with the love interest.)

  • The strongman. Unless The One is physically strong, he’ll likely need additional muscle, possibly even in the form of a bodyguard. This works in traditional fantasy, where it’s standard for the mages to be weaklings with massive hidden power. For most other styles, it’s harder to justify, but a tough guy is welcome in any party.

  • The academic. Some stories rely on the fact that The One doesn’t know everything about his potential, his destiny, his enemies, or even himself. The academic, then, serves the role of exposition, allowing the audience to learn about these things at the same time as the hero. This kind of character shines in the early acts of a story; by the end, dramatic pacing takes precedence, and the academic is no longer needed.

  • The otherworldly. In stories with a significant supernatural element, The One might have an inhuman friend or ally. This could be anything from a guardian angel, to an elemental creature, to a bound demon, to even an alien. This otherworldly character can break the rules the story sets for “normal” humans, as well as giving the protagonist an outside perspective. It can also function as a kind of academic, as beings from other worlds or planes often have hidden knowledge.

  • The turncoat. There are two ways you can go with this character. Either he’s someone who turned on The One—in which case, the turncoat makes a good secondary villain—or he turned on The One’s enemy to join the “good guys”. This second possibility is the more interesting, story-wise, because it’s almost like adding a second origin story. Why did he turn? Is he going to try and double-cross The One? The turncoat can also be a way to provide inside information that the protagonist logically shouldn’t have access to.

Conclusion

Writing The One is easy. Writing one of them to be more than simple wish-fulfillment is much harder. Put yourself in your characters’ shoes. Not just the protagonist, but the supporting crew, too. Think about the mechanism of fate, as it exists in the world you’re creating. And think about how you show the power that The One has. Sure, explosions are eye-catching, but they aren’t everything. The One can outwit his foes just as easily as he can overpower them, and sometimes that’s exactly what he must do.

Let’s make a language – Part 7c: Adjectives (Ardari)

(Editor’s note: If you’re wondering about the odd posting time, well, there’s a simple explanation. I wrote this on September 14, but I noticed when I went to schedule it that it would appear on October 16. That’s my birthday, and 5:38 PM is what I’ve been told was my time of birth. So, when this goes up, I’ll be 32. I couldn’t resist the extra touch.)

For Ardari, adjectives look like nouns at first glance. They take all the usual inflections for case and number, with the additional wrinkle that they agree with their head nouns in gender. Because of this, the “dictionary” form of an adjective will always be the neuter form: dyet “good”, òlk “loud”, jysall “sad”, chel “young”.

We can add these adjectives into a noun phrase by placing them before the head noun: dyeta rhasa “good dog”; òlko blèdo “loud animals”; jysalla konatö “the sad man”; chelisèn nälisèntös “of the young women”. As you can see from the last two examples, adjectives modifying nouns don’t need articles.

In contrast to English (and Isian, for that matter), Ardari adjectives work just fine alone, without the need for a head noun. In this case, they inflect as if they were neuter nouns: dyetardös “the good ones”.

Predicate adjectives

We can go the other way, too, and make adjectives into verbs, although this only works with certain words. Three of our four examples work: dèblatö òlkda “the river is loud”; sèdardös jysalldiru “the children are not sad”; pwatö chelda “the boy is young”. (Note that these verbified adjectives act like inactive verbs, using patient concord markings for their subjects.)

For dyet and words like it, we use a different, more general, approach. This involves the copula verb èll-, and it’s just like making a normal sentence. The adjective agrees with the subject noun in gender, but it’s always in the nominative case: rhasatö èlla dyeta “the dog is good”.

In fact, any adjective can be used in this copula construction. It implies a more “permanent” state than directly using the adjective directly. So, instead of dèblatö òlkda, we might say dèblatö èlla òlka, which has the same meaning, but carries the connotation that this particular river is always loud.

Comparatives

Ardari doesn’t have special adjective versions for comparatives and superlatives, like English does. Instead, it has a general word am that can appear before an adjective. It does double duty, acting like both “more” and “most”, with the actual meaning depending on context.

In a simple noun phrase, it’s usually a superlative: am dyeto rhasodys “the best dogs”. The exception is when it’s being made into a comparative phrase, which we’ll meet in a future post.

When used on a bare adjective, am always means “most”: am dyetardös “the best”.

On a predicate, am implies the superlative unless it’s clear from context that it’s a comparison. As an example, we might have uswall tyèktö èlla grov “the blue house is big” followed by ajzhtö èlla am grov “the white house is bigger”. If we just said ajzhtö èlla am grov alone, the meaning would instead be “the white house is the biggest”.

Phonetic alteration

That just about does it for Ardari adjectives, except for one thing. Some of these words change slightly. In the neuter form, they have a regular, non-palatalized consonant. In the other genders, these can become palatalized.

One example of this is mil “happy”. In the neuter, it stays how it’s written: mil sèd “a happy child”. Otherwise, it changes: milya pwa “a happy boy*; milyi gli “a happy girl”.

This change can happen with many consonants in Ardari. The stops alternate with their palatalized versions (p becomes py, etc.), while l and n become ly and ny, respectively.

Ardari word list

Like with Isian, here’s a huge list of Ardari words. Verbs are always listed as stems (you can tell by the hyphen at the end), and adjectives are shown in neuter form.

There are three adjectives in the list that show the palatalizing change. These are shown with a following (y), as in mil(y) for “happy”.

Two specific words need to be pointed out. First, “not” is listed as -(r)u, which shows the two possible forms of the negative verbal suffix, -u after consonants and -ru after vowels. Second, the word for “friend” changes based on gender: neuter ast, masculine asta, feminine asti. This is shown as ast(a/i).

English Ardari
air impän
all laz
angry nyol
animal blèda
any by
arm kyem
back sur
bad gall
beautiful sli
bed mäs
big grov
bird pèdi
bitter nykh
black zar
blood chonga
blue uswall
boat druni
body apsa
bone oqa
book byzri
bottom tòn
boy pwa
bread nami
bright wich
brother emöna
car kolyi
cat avbi
chest ghall
child sèd
city präzda
closed nòp
cloth chill
cloud nawra
cold glaz
color kyos
correct rik
cup kykad
daughter tyeri
day jan
daytime tulyana
dim nyn
dog rhasa
door kopa
dress lesri
drink ach
dry khèv
ear mèka
earth dyevi
egg oghi
every ining
eye agya
face sòl
false ill
father aba
few ikön
field tevri
finger inda
fire aghli
flower afli
food fès
foot allga
forest tyëtoma
friend ast(a/i)
front chej
fruit zulyi
girl gli
glass träll
gold owènyi
good dyet
grass sèrki
green rhiz
hair zhaj
hand kyur
happy mil(y)
hard khòrd
hat sèla
head chäf
heart rocha
hill dyumi
hot fed(y)
house tyèk
ice sill
island symli
king kujda
knife yagha
lake oltya
leaf däsi
left fong
leg khära
light blis
long tur
loud òlk
man kona
many majos
meat arba
milk mechi
moon duli
mother emi
mountain antövi
mouth mim
name all
narrow will
net pèrta
new vän
nice tèch
night goz
nose khun
not -(r)u
old pòd
open owar
paper rhesta
peace ichuri
pen pyela
person ban
plant pämi
poor nydor
pot gyazi
queen kujvi
rain luza
red jor
rich agris
right leng
river dèbla
rock qada
rough dyaraz
sad jysall
scent ymin
sea oska
sharp krit
shirt tèwar
shoe saz
short (tall) nyan
short (long) nèr
silent däch
sister tamöni
skin prall
sky weli
small nèr
smooth chus
snow qäsa
soft èz
son era
sound onda
sour rukh
star pala
sun chi
sweet ojet(y)
sword èngla
table kombas
tail pija
tall vol
thick gwad
thin tip
to allow rhoten-
to ask mykhes-
to be èll-
to begin sòto-
to blow fu-
to build moll-
to burn secha-
to buy dyem-
to catch kòp-
to come ton-
to cook lòsty-
to cry ajn-
to cut okön-
to dance tatyer-
to die lo-
to do agh-
to drink kabus-
to eat tum-
to end jop-
to enter idyn-
to feel luch-
to give anyer-
to go chin-
to guard chud-
to have per-
to hear ablon-
to hit king-
to hold yfily-
to hunt kwar-
to kiss alym-
to know trod-
to laugh jejs-
to learn prèll-
to like lyeb-
to live derva-
to live in daran-
to look at tojs-
to look for tèlas-
to love salm-
to make grät-
to plant mäp-
to play rej-
to pray nyes-
to read proz-
to receive bèrill-
to run okhyn-
to say is-
to see ivit-
to sell vird-
to sing ajang-
to sit bun-
to sleep rhèch-
to smell aws-
to speak sim-
to stand minla-
to taste aty-
to teach sydon-
to think bejë-
to throw ghur-
to touch tejv-
to walk brin-
to want majtas-
to wash oznèr-
to wear ilya-
to write farn-
tongue lèta
tooth käga
top khaj
tree buri
true chäll
ugly qöbar
war idyaza
warm fynin
water obla
wet bol
white ajzh
wide wok
wind fawa
wise trodyn
woman näli
wood dräza
word non
world omari
wrong nej
year avèch
yellow mingall
young chel

On learning to code

Coding is becoming a big thing right now, particularly as an educational tool. Some schools are promoting programming and computer science classes, even a full curriculum that lasts through the entirety of education. And then there are the commercial and political movements such as Code.org and the Hour of Code. It seems that everyone wants children to learn something about computers, beyond just how to use them.

On the other side of the debate are the detractors of the “learn to code” push, who argue that it’s a boondoggle at best. Not everybody can learn how to code, they argue, nor should they. We’re past the point where anyone who wants to use a computer must learn to program it, too.

Both camps have a point, and I can see some merit in either side of the debate. I was one of a lucky few that did have the chance to learn about programming early in school, so I can speak from experience in a way that most others cannot. So here are my thoughts on the matter.

The beauty of the machine

Programming, in my opinion, is an exercise that brings together a number of disparate elements. You need math, obviously, because computer science—the basis for programming—is all math. You also need logic and reason, talents that are in increasingly short supply among our youth. But computer programming is more than these. It’s math, it’s reasoning, it’s problem solving. But it’s also art. Some problems have more than one solution, and some of those are more elegant than others.

At first glance, it seems unreasonable to try to teach coding to children before its prerequisites. True, there are kid-friendly programming environments, like MIT’s Scratch. But these can only take you so far. I started learning BASIC in 3rd grade, at the age of 8, but that was little more than copying snippets of code out of a book and running them, maybe changing a few variables here and there for different effects. And I won’t pretend that that was anywhere near the norm, or that I was. (Incidentally, I was the only one that complained when the teacher—this was a gifted class, so we had the same teacher each year—took programming out of the curriculum.)

My point is, kids need a firm grasp of at least some math before they can hope to understand the intricacies of code. Arithmetic and some concept of algebra are the bare minimum. General computer skills (typing, “computer literacy”, that sort of thing) are also a must. And I’d want some sort of introduction to critical thinking, too, but that should be a mandatory part of schooling, anyway.

I don’t think that very young students (kindergarten through 2nd grade) should be fooling around with anything more than a simple interface to code like Scratch. (Unless they show promise or actively seek the challenge, that is. I’m firmly in favor of more educational freedom.) Actually writing code requires, well, writing. And any sort of abstraction—assembly on a fictitious processor or something like that—probably should wait until middle school.

Nor do I think that coding should be a fixed part of the curriculum. Again, I must agree somewhat with the learn-to-code detractors. Not everyone is going to take to programming, and we shouldn’t force them to. It certainly doesn’t need to be a required course for advancement. The prerequisites of math, critical thinking, writing, etc., however, do need to be taught to—and understood by—every student. Learning to code isn’t the ultimate goal, in my mind. It’s a nice destination, but we need to focus on the journey. We should be striving to make kids smarter, more well-rounded, more rational.

Broad strokes

So, if I had my way, what would I do? That’s hard to say. These posts don’t exactly have a lot of thought put in them. But I’ll give it a shot. This will just be a few ideas, nothing like an integrated, coherent plan. Also, for those outside the US, this is geared towards the American educational system. I’ll leave it to you to convert it to something more familiar.

  • Early years (K-2): The first years of school don’t need coding, per se. Here, we should be teaching the fundamentals of math, writing, science, computer use, typing, and so on. Add in a bit of an introduction to electronics (nothing too detailed, but enough to plant the seed of interest). Near the end, we can introduce the idea of programming, the notion that computers and other digital devices are not black boxes, but machines that we can control.

  • Late elementary (3-5): Starting in 3rd grade (about age 8-9), we can begin actual coding, probably starting with Scratch or something similar. But don’t neglect the other subjects. Use simple games as the main programming projects—kids like games—but also teach how programs can solve problems. And don’t punish students that figure out how to get the computer to do their math homework.

  • Middle school (6-8): Here, as students begin to learn algebra and geometry (in my imaginary educational system, this starts earlier, too), programming can move from the graphical, point-and-click environments to something involving actual code. Python, JavaScript, and C# are some of the better bets, in my opinion. Games should still be an important hook, but more real-world applications can creep in. You can even throw in an introduction to robotics. This is the point where we can introduce programming as a discipline. Computer science then naturally follows, but at a slower pace. Also, design needs to be incorporated sometime around here.

  • High school (9-12): High school should be the culmination of the coding curriculum. The graphical environments are gone, but the games remain. With the higher math taught in these grades, 3D can become an important part of the subject. Computer science also needs to be a major focus, with programming paradigms (object-oriented, functional, and so on) and patterns (Visitor, Factory, etc.) coming into their own. Also, we can begin to teach students more about hardware, robotics, program design, and other aspects beyond just code.

We can’t do it alone

Besides educators, the private sector needs to do its part if ubiquitous programming knowledge is going to be the future. There’s simply no point to teaching everyone how to code if they’ll never be able to use such a skill. Open source code, open hardware, free or low-cost tools, all these are vital to this effort. But the computing world is moving away from all of them. Apple’s iOS costs hundreds of dollars just to start developing. Android is cheaper, but the wide variety of devices means either expensive testing or compromises. Even desktop platforms are moving towards the walled garden.

This platform lockdown is incompatible with the idea of coding as a school subject. After all, what’s the point? Why would I want to learn to code, if the only way I could use that knowledge is by getting a job for a corporation that can afford it? Every other part of education has some reflection in the real world. If we want programming to join that small, elite group, then we must make sure it has a place.

Release: Before I Wake

So I’ve written my first book. Actually, I finished writing it months ago. Editing, cover design, and all that other stuff that the pros get done for them took up the rest of the time. However you want to put it, it’s done. Here’s the page I’ve set up for it on this site. In there, you can find some info about the book, as well as links to anywhere I’ve put it up for sale. As of right now, that’s only Amazon, but I hope to expand the list eventually.

With this release, I’ve also taken the time to do some minor redecorating. Namely, the sidebar. I’ve added two sections over there. One of them has a list of my published works, something that will (hopefully!) grow to be much longer in the coming months and years. Below that is another list for ebooks that aren’t mine. I’m not the only writer in my family, and family sticks together, so I don’t mind giving a little bit of publicity. The first entry is my brother’s debut novella, Angel’s Sin. It’s firmly in the genre of fantasy erotica, and it’s a bit…odd, so be warned. Anyway, that’s another list that will grow in the future.

I won’t claim that Before I Wake is any great story. I like to think of it as the greatest novel I’ve ever written, but there’s only one other competitor for that title, and it’s…not that good. Maybe I’m too hard on myself. Who knows? However it turns out, I’ve discovered that I like to write. So I’m going to keep on doing that. Surely I can’t be the worst author ever.

How I made a book with Markdown and Pandoc

So I’m getting ready to self-publish my first book. I’ll have more detail about that as soon as it’s done; for now, I’m going to talk a little about the behind-the-scenes work. This post really straddles the line between writing and computers, and there will be some technical bits, so be warned.

The tech

I’ll admit it. I don’t like word processors that much. Microsoft Word, LibreOffice Writer, or whatever else is out there (even the old standby: WordPerfect), I don’t really care for them. They have their upsides, true, but they just don’t “fit” me. I suspect two reasons for this. First, I’m a programmer. I’m not afraid of text, and I don’t need shiny buttons and WYSIWYG styling. Second, I can be a bit obsessive. Presented with all the options of a modern word processor, like fonts and colors and borders and a table of contents, I’d spend more time fiddling with options than I would writing! So, when I want to write, I don’t bother with the fancy office apps. I just fire up a text editor (Vim is my personal choice, but I wouldn’t recommend it for you) and get to it.

“But what about formatting?” you may ask. Well, that’s an interesting story. At first, I didn’t even bother with inline formatting. I used the old-school, ad hoc styling familiar to anybody who remembers USENET, IRC, or email conversations. Sure, I could use HTML, just like a web page would, but the tags get in the way, and they’re pretty ugly. So I simply followed a few conventions, namely:

  • Chapter headers are marked by a following line of = or -.
  • A blank line means a paragraph break.
  • Emphasis (italics or text in a foreign language, for example) is indicated by surrounding _.
  • Bold text (when I need it, which is rare) uses *.
  • Scene breaks are made with a line containing multiple * and nothing else. (e.g., * * *)

Anything else—paragraph indentation, true dashes, block quotes, etc.—I’d take care of when it was time to publish. (“I’ll fix it in post.”) Simple, quick, and to the point. As a bonus, the text file is completely readable.

Mark it up

I based this system on email conventions and the style used by Project Gutenberg for their text ebooks. And it worked. I’ve written about 400,000 words this way, and it’s certainly good for getting down to business. But it takes a lot of post-processing, and that’s work. As a programmer, work is something I like to avoid.

Enter Markdown. It’s not much more than a codified set of conventions for representing HTML-like styling in plain text, and it’s little different from what I was already using. Sounds great. Even better, it has tool support! (There’s even a WordPress plugin, which means I can write these posts in Markdown, using Vim, and they come out as HTML for you.)

Markdown is great for its intended purpose, as an HTML replacement. Books need more than that, though; they aren’t just text and formatting. And that’s where the crown jewel comes in: Pandoc. It takes in Markdown text and spits out HTML or EPUB. And EPUB is what I want, because that’s the standard for ebooks (except Kindle, which uses MOBI, but that’s beside the point).

Putting the pieces together

All this together means that I have a complete set of book-making tools without ever touching a word processor, typesetting program, or anything of the sort. It’s not perfect, it’s not fancy, and it certainly isn’t anywhere near professional. But I’m not a professional, am I?

For those wondering, here are the steps:

  1. Write book text in Pandoc-flavored Markdown. (Pandoc has its own Markdown extensions which are absolutely vital, like header identifiers and smart punctuation.)

  2. Write all the other text—copyright, dedication, “About the Author”, and whatever else you need. (“Front matter” and “back matter” are the technical terms.) I put these in separate Markdown files.

  3. Create EPUB metadata file. This contains the author, title, date, and other attributes that ebook readers can use. (Pandoc uses a format called YAML for this, but it also takes XML.)

  4. Make a cover. This one’s the hard part for me, since I have approximately zero artistic talent.

  5. Create stylesheet and add styling. EPUB uses the same CSS styling as HTML web pages, and Pandoc helps you a lot with this. Also, this is where I fix things like chapter headings, drop caps/raised initials, and so on.

  6. Run Pandoc to generate the EPUB. (The command would probably look something like this: pandoc --smart --normalize --toc-depth=1 --epub-stylesheet=<stylesheet file> --epub-cover-image=<cover image> -o <output file> <front matter .md file> <main book text file(s)> <back matter .md file> <metadata .yml or .xml file>)

  7. Open the output file in an ebook reader (Calibre, for me) and take a look.

  8. Repeat steps 5 and 6 until the formatting looks right.

  9. Run KindleGen to make a MOBI file. You only need this if you intend to publish on Amazon’s store. (I do, so I had to do this step.)

  10. Bask in the glory of creating a book! Oh, and upload your book to wherever. That’s probably a good idea, too.

Yeah, there are easier methods. A lot of people seem allergic to the command line; if you’re one of them, this isn’t the way for you. But I’m comfortable in the terminal. As I said, I’m a programmer, so I have to be. The hardest part for me (except the cover) was figuring out the options I needed to make something that looked like a proper ebook.

Even if you don’t use my cobbled-together method of creating an ebook, you still owe it to yourself to check out Pandoc. It’s so much easier, in my opinion, than a word processor or ebook editor. There are even graphical front-ends out there, if that’s what you prefer. But I like working with plain text. It’s easy, it’s readable, and it just works.

Let’s make a language – Part 7b: Adjectives (Isian)

Adjectives in Isian, like in English, aren’t that much of a problem. They don’t have a specific form that marks them out as what they truly are. They don’t change for number like nouns do. They’re really just…there. A few examples of Isian adjectives include wa “big”, hul “cold”, yali “happy”, and almerat “wise”.

As we saw in the last Isian post, the normal word order puts adjectives before nouns, and articles before adjectives. So we can make fuller noun phrases like ta wa talar “a big house” or e yali eshe “the happy girl”. In each case, the order is mostly the same as in English: article, then adjective, then noun.

We can even string adjectives together: es almerat afed sami “the wise old men”. (If you prefer adding commas between adjectives, that’s fine, too. It’s okay to write es almerat, afed sami, but it’s not required.)

Like in English, we can’t use an adjective like this without a noun. It’s not grammatical in Isian to say es almerat. Instead, we have to add an extra word, a: es almerat at “the wise ones”. (At least it has a regular plural form.) After a vowel, it becomes na: ta wa na “a big one”.

We can also use an adjective as a predicate. Here, it follows the copula (tet or one of its conjugations). An example might be en yali “I am happy”.

Isian adjectives also have equivalents to the English comparative and superlative (“-er” and “-est”) forms. As with many suffixes in the language, these vary based on the stem’s ending. For consonant-stems, the comparative is -in and the superlative is -ay. Vowel-stems simply insert a d at the beginning of the suffix to make -din and -dai, respectively. So yali “happy” becomes yalidin “happier* and yaliday “happiest”, while hul “cold” turns into hulin “colder” and hulai “coldest”.

There are a couple of differences, though. First, these suffixes can be used on any adjective; Isian has no counterparts to those English adjectives that require “more” and “most” instead of “-er” and “-est”. (On the plus side, we don’t have to worry about three forms for bil “good”. It’s fully regular: bil, bilin “better”, bilai “best”.)

Second, adjectives that are derived from nouns, like “manly” from “man”, usually can’t take the superlative. We haven’t yet seen any of those (or even how to make them). For these, the comparative serves both purposes.

That’s pretty much all there is to adjectives in Isian, as far as the basics are concerned. Now we can make quite a few more complex phrases and even some nice sentences. There’s still a lot more to come, though.

Isian word list

Not every word that we’ve seen is in this list, but it covers almost all of the “content” words in their base forms, along with a whole bunch of new ones you can try out. Also, words with irregular plurals have their plural suffixes shown in parenthesis, e.g., the plural of tay is tays.

English Isian
air rey
all sota
angry hayka
animal embin
any ese
arm ton
back bes
bad num
beautiful ichi
bed dom
big wa
bird firin
bitter guron
black ocom
blood miroc
blue sush
boat sholas
body har
bone colos
book peran
bottom dolis
boy jed
bread pinda(r)
bright lukha
brother doyan
car choran
cat her
chest sinal
child tay(s)
city eblon
closed noche
cloth waf
cloud albon
cold hul
color echil
correct ochedan
cup deta(s)
daughter sali(r)
day ja
daytime jamet
dim rum
dog hu
door opar
dress lash
drink adwar
dry khen
ear po(s)
earth tirat
egg gi(r)
every alich
eye bis
face fayan
false nanay
father pado(s)
few uni
field bander
finger ilca(s)
fire cay
flower atul
food tema
foot pusca
forest tawetar
friend chaley
front hamat
fruit chil
girl eshe(r)
glass arcol
gold shayad
good bil
grass tisen
green tich
hair pardel
hand fesh
happy yali
hard dosem
hat hop
head gol
heart sir
hill modas
hot hes
house talar
ice yet
island omis
king lakh
knife hasha
lake fow
leaf eta
left kintes
leg dul
light say
long lum
loud otar
man sam
many mime
meat shek
milk mel
moon nosul
mother mati(r)
mountain abrad
mouth ula
name ni
narrow ilcot
net rec
new ekho
nice nim
night chok
nose nun
not an
old afed
open bered
paper palil
peace histil
pen etes
person has
plant dires
poor umar
pot fan
queen lasha(r)
rain cabil
red ray
rich irdes
right estes
river ficha(s)
rock tag
rough okhor
sad nulsa
scent inos
sea jadal
sharp checor
shirt jeda(s)
shoe taf
short (tall) wis
short (long) wis
silent anchen
sister malin
skin kirot
sky halac
small ish
smooth fu
snow saf
soft ashel
son sor
sound polon
sour garit
star key
sun sida
sweet lishe
sword seca
table mico
tail hame
tall wad
thick gus
thin tin
to allow likha
to ask oca
to be tet
to begin nawe
to blow furu
to build oste
to burn becre
to buy tochi
to catch sokhe
to come cosa
to cook piri
to cry acho
to cut sipe
to dance danteri
to die nayda
to do te
to drink jesa
to eat hama
to end tarki
to enter yoweni
to feel ilsi
to give jimba
to go wasa
to guard holte
to have fana
to hear mawa
to hit icra
to hold otasi
to hunt ostani
to kiss fusa
to know altema
to laugh eya
to learn nate
to like mire
to live liga
to live in dalega
to look at dachere
to look for ediche
to love hame
to make tinte
to plant destera
to play bela
to pray barda
to read lenira
to receive rano
to run hota
to say ki
to see chere
to sell dule
to sing seri
to sit uba
to sleep inama
to smell nore
to speak go
to stand ayba
to taste cheche
to teach reshone
to think tico
to throw bosa
to touch shira
to walk coto
to want doche
to wash hishi
to wear disine
to write roco
tongue dogan
tooth ten
top poy
tree taw
true ferin
ugly agosh
war acros
warm him
water shos
wet shured
white bid
wide pusan
wind naf
wise almerat
woman shes
wood totac
word ur
world sata(r)
wrong noni
year egal
yellow majil
young manir

Off week

I’m not doing a programming post this week. Sorry about that. Normally, I have things scheduled at least a week in advance, and that’s true now. But I’ve still decided to take the week off. Why? Upgrades. Specifically, I’ve been upgrading my main desktop.

I have two PCs, a desktop and a laptop, both running different flavors of Linux. The laptop runs Ubuntu (currently 12.04, because it’s old and I’m not particularly keen on running through the hassle of an Ubuntu upgrade, even an LTS one), and it’s not really a problem. The desktop, though, is where I’ve been bolder. It’s currently running Debian Testing, and that is where the problem lies.

If you don’t know, Debian has a three-way division of versions. There’s Stable, which is just what you’d expect; once it comes out, it’s pretty much fixed, only receiving the security fixes and the occasional backport. Testing—the one I’m using—is more up to date, at the risk of causing possible breakage. And then Unstable is the “raw” form, the absolute newest versions of almost everything, bugs or no bugs.

Packages (applications like LibreOffice or libraries like libpng) start off in Unstable with each new version. If nobody finds any critical bugs after a few days, and there’s no other reason to hold things up, then it moves into Testing. Every couple of years (give or take), Testing is “frozen”, and the new Stable is made from that. It’s a slick process…most of the time.

A few weeks ago, fate conspired to throw a wrench into this well-oiled machine. KDE, the desktop environment that I use on the Debian computer, started a major upgrade, from version 4 to version 5. (There’s a whole big change in branding, but I don’t care about the details. In my mind, it’s KDE 5, and that’s that.) This broke a lot of things, because KDE 5 uses new libraries, new modules, and even a few new applications. So I held off on updating that for a while.

But that’s not all. KDE, like many other parts of a working Linux system, is written in C++. And C++ has had some recent major changes itself, namely the C++11 update to the standard. With C++11 comes a new ABI. This goes all the way down the stack to the compiler, GCC, which implemented the new ABI as part of its own version 5 upgrade. That was a major change that would break more than a few things, so I held off on that update, too.

Earlier this week, though, I decided to take the plunge. The main reason that prompted this was some seemingly unrelated library update that broke the integration between KDE and GTK+ that made certain applications (like Iceweasel, Debian’s “de-branded” Firefox) look horribly out of place.

So I did it. Things broke, but I’ve been able to put most of them back together. KDE 5 is…not too bad, compared to 4. It’s early yet, so I’ll give it a little time before I come to a final decision. But my initial impression is that it’s what Windows 8 was trying to be. Like Windows 8, it changes a lot of things for no good reason, leaving users to find a way to put them back the way they were. But it’s nowhere near as bad as the transition from KDE 3 to 4, from what I’ve heard. It’s the combination of the KDE upgrade and the C++ ABI transition that made things so bad. Now, though, the worst is (hopefully) behind me, and I’ll be able to get back to regular posting next week.

Mars: fantasy and reality

Mars is in the public consciousness right now. The day I’m writing this, in fact, NASA has just announced new findings that indicate flowing water on the Red Planet. Of course, that’s not what most people are thinking about; the average person is thinking of Mars because of the new movie The Martian, a film based on a realistic account of a hypothetical Mars mission from the novel of the same name.

We go through this kind of thing every few years. A while back, it was John Carter. A few years before that, we had Mission to Mars and Red Planet. Go back even further, and you get to Total Recall. It’s not really that Mars is just now appearing on the public’s radar. No, this goes in cycles. The last crop of Martian movies really came about from the runaway success of the Spirit and Opportunity rovers. Those at the turn of the century were inspired by earlier missions like Mars Pathfinder. And The Martian owes at least some of its present hype to Curiosity and Phoenix, the latest generation of planetary landers.

Move outside the world of mainstream film and into written fiction, though, and that’s where you’ll see red. Mars is a fixture of science fiction, especially the “harder” sci-fi that strives for realism and physical accuracy. The reasons for this should be obvious. Mars is relatively close, far nearer to Earth than any other body that could be called a planet. Of the bodies in the solar system besides our own world, it’s probably the least inhospitable, too.

Not necessarily hospitable, mind you, but Mars is the least bad of all our options. I mean, the other candidates look about as habitable as the current Republican hopefuls are electable. Mercury is too hot (mostly) and much too difficult to actually get to. Venus is a greenhouse pressure cooker. Titan is way too cold, and it’s about a billion miles away, to boot. Most everything else is an airless rock or a gas giant, neither of which scream “habitable” to me. No, if you want to send people somewhere useful in the next couple of decades, you’ve got two options: the moon and Mars. And we’ve been to the moon. (Personally, I think we should go back there before heading to Mars, but that seems to be a minority opinion.)

But say you want to write a story about people leaving Earth and venturing out into the solar system. Well, for the same reasons, Mars is an obvious destination. But the role it plays in a fictional story depends on a few factors. The main one of these is the timeframe. When is your story set? In 2050? A hundred years from now? A thousand? In this post, we’ll look at how Mars changes as we move our starting point ahead in time.

The near future

Thanks to political posturing and the general anti-intellectual tendencies of Americans in the last generation, manned spaceflight has taken a backseat to essentially everything else. As of right now, the US doesn’t even have a manned craft, and the only one on the drawing board—the Orion capsule—is intentionally doomed to failure through budget cuts and appropriations adjustments. The rest of the world isn’t much better. Russia has the Soyuz, but it’s only really useful for low-Earth orbit. China doesn’t have much, and they aren’t sharing, anyway. Private companies like SpaceX are trying, but it’s a long, hard road.

So, barring a reason for a Mars rush, the nearest future (say, the next 15-20 years) has our planetary neighbor as a goal rather than a place. It’s up there, and it’s a target, but not one we can hit anytime soon. The problem is, that doesn’t make for a very interesting story.

Move up to the middle of this century, starting around 2040, and even conservative estimates give us the first manned mission to Mars. Now, Mars becomes like the moon in the 1960s, a destination, a place to be conquered. We can have stories about the first astronauts to make the long trip, the first to blaze the trail through interplanetary space.

With current technology, it’ll take a few months to get from Earth to Mars. The best times happen once every couple of years; any other time would increase the travel duration dramatically. The best analogy for this is the early transoceanic voyages. You have people stuck in a confined space together for a very long time, going to a place that few (or none) have ever visited, with a low probability of survival. Returning early isn’t an option, and returning at all might be nearly impossible. They will run low on food, they will get sick, they will fight. Psychology, not science, can take center stage for a lot of this kind of story. A trip to Mars can become a character study.

The landing—assuming they survive—moves science and exploration back to the fore. It won’t be the same as the Apollo program. The vagaries of orbital mechanics mean that the first Mars missions won’t be able to pack up and leave after mere hours, as Apollo 11 did. Instead, they’ll be stuck for weeks, even months. That’s plenty of time to get the lay of the land, to do proper scientific experiments, to explore from ground level, and maybe even to find evidence of Martian life.

The middle

In the second half of this century, assuming the first trips are successful, we can envision the second stage of Mars exploration. This is what we should have had for the moon around 1980; the most optimistic projections from days gone by (Zubrin’s Mars Direct, for example) put it on Mars around the present day. Here, we’ve moved into a semi-permanent or permanent presence on Mars for scientific purposes, a bit like Antarctica today. Shortly after that, it’s not hard to envision the first true colonists.

Both of these groups will face the same troubles. Stories set in this time would be of building, expanding, and learning to live together. Mars is actively hostile to humans, and this stage sees it becoming a source of environmental conflict, an outside pressure acting against the protagonists. Antarctica, again, is a good analogy, but so are the stories of the first Europeans to settle in America.

The trip to Mars won’t get any shorter (barring leaps in propulsion technology), so it’s still like crossing the Atlantic a few centuries ago. The transportation will likely be a bit roomier, although it might also carry more people, offsetting the additional capacity. The psychological implications exist as before, but it’s reasonable to gloss over them in a story that doesn’t want to focus on them.

On the Red Planet itself, interpersonal conflicts can develop. Disasters—the Martian dust storm is a popular one—can strike. If there is native life in your version of Mars, then studying it becomes a priority. (Protecting it or even destroying it can also be a theme.) And, in a space opera setting, this can be the perfect time to inject an alien artifact into the mix.

Generally speaking, the second stage of Mars exploration, as a human outpost with a continued presence, is the first step in a kind of literary terraforming. By making Mars a setting, rather than a destination, the journey is made less important, and the world becomes the focus.

A century of settlement

Assuming our somewhat optimistic timeline, the 22nd century would be the time of the land grab. Propulsion or other advances at home make the interplanetary trip cheaper, safer, and more accessible. As a result, more people have the ability to venture forth. Our analogy is now America, whether the early days of colonization in the 17th century or the westward push of manifest destiny in the 19th.

In this time, as Mars becomes a more permanent human settlement, a new crop of plot hooks emerges. Social sciences become important once again. Religion and government, including self-government, would be on everyone’s minds. Offshoot towns might spring up.

And then we get to the harder sciences, particularly biology. Once people are living significant portions of their lives on a different planet, they’ll be growing their own food. They’ll be dying, their bodies the first to be buried in Martian soil. And they’ll be reproducing.

Evolution will affect every living thing born on Mars, and we simply don’t know how. The lower gravity, the higher radiation, the protective enclosure necessary for survival, how will these changes affect a child? It won’t be an immediate change, for sure, but the second or third generation to be born on Mars might not be able to visit the birthplace of humanity. Human beings would truly split into two races—a distinction that would go far beyond mere black and white—and the word Martian would take on a new meaning.

Mars remains just as hostile as before, but it’s a known danger now. It’s the wilderness. It’s a whole world awaiting human eyes and boots.

Deeper and deeper

As time goes by, and as Mars becomes more and more inhabited, the natural conclusion is that we would try to make it more habitable. In other words, terraforming. That’s been a presence in science fiction for decades; one of the classics is Kim Stanley Robinson’s Mars trilogy, starting with Red Mars.

In the far future, call it about 200 years from now, Mars can truly begin to become a second planet for humanity. At this point, people would live their whole lives there, never once leaving. Towns and cities could expand, and an ultimate goal might arise: planetary independence.

But the terraforming is the big deal in this late time. Even the best guesses make this a millennia-long process, but the first steps can begin once enough people want them to. Thickening the atmosphere, raising the worldwide temperature, getting water to flow in more than the salty tears NASA announced on September 28, these will all take longer than a human lifetime, even granting extensive life-lengthening processes that might be available to future medicine.

For stories set in this time, Mars can again become a backdrop, the set upon which your story will take place. The later the setting, the more Earth-like the world becomes, and the less important it is that you’re on Mars.

The problems these people would face are the same as always. Racial tensions between Earthlings and Martians. The perils of travel in a still-hostile land. The scientific implications of changing an entire world. Everything to do with building a new society. And the list goes on, limited only by your imagination.

Look up

Through the failings of our leaders, the dream of Mars has been delayed. But all is not lost. We can go there in our minds, in the visuals of film, the words of fiction. What we might find when we arrive, no one can say. The future is what we make of it, and that is never more true than when you’re writing a story set in it.

Let’s make a language – Part 7a: Adjectives (Intro)

We’ve talked about nouns. We’ve talked about verbs. That’s two of the main three parts of speech present in most languages, which leaves only one, and that one is the subject of this post.

Adjectives are describing words. They tell us something about a noun, such as its color (“red”), its shape (“round”), or its mood (“angry”). In theory, that’s pretty much all there is to the adjective, but we can’t stop there.

A brief introduction

Just about every language has adjectives. (Most of those that claim they don’t are merely cleverly disguising them.) And most languages have a few different sorts of adjectives. The main kind—probably the most interesting—is the attributive adjective. That’s the one that modifies a noun or noun phrase to add detail: “the red door”, “a big deal”. We’ll be seeing a lot of these.

Predicate adjectives don’t directly modify a noun phrase. Instead, they function as a “predicate”, basically like the object to a verb, as in English “the child is happy“, “that man is tall“. We’ll talk more about them a little later, because they can be quite special.

Most of the other types besides these two aren’t quite as important, but they serve to show that adjectives are flighty. Some languages let them act like nouns (the canonical English example is the biblical quote “the meek shall inherit the earth”). Some treat them like verbs, a more extreme variant of the predicate adjective where it’s the adjective itself that is marked for tense and concord and all the other verb stuff. Adjectives can even have their own phrases, just like nouns and verbs. In this case, other adjectives (or adverbs) modify the main one, further specifying meaning.

So there’s actually a lot more to the humble adjective than meets the eye.

Attributives

First, we’ll look at the attributive adjectives. Except for the head noun, these will probably be the “meatiest” portions of noun phrases, in terms of how much meaning they provide. Depending on the language, they can go either before or after a noun, as we saw when we looked at word order. English, for example, puts them before, while Spanish likes them to go after the head noun.

In languages with lots of nominal distinction (case, number, gender, etc.), there’s a decision to be made. Do adjectives follow their head nouns in taking markers for these categories? They do in Spanish (la casa grande, las casas grandes), but not in English (“the big house”, “the big houses”). Also, if gender is assigned haphazardly, as it is in so many languages, do adjectives have a “natural” gender, or are there, say, separate masculine and feminine forms? What about articles? Arabic, for example, requires an adjective to take the definite article al- if it modifies a noun with one. Basically, the question can be summed up as, “How much are attributive adjectives like nouns?”

English is near one end of the spectrum. An English adjective has no special plural form; indeed, it doesn’t change much at all. At the other end, we can imagine adjectives that are allowed to completely take the place of nouns, where they are inflected for case and number and everything else, and they function as the heads of noun phrases, perhaps with a suffix or something to remind people of their true nature. Languages like this, in fact, are the norm, and English is more like the exception.

Predicates

Predicate adjectives (the technical term is actually “predicative”, but I find it a bit clumsy), by contrast, seem more like verbs. In English, as in many languages, they are typically the objects of the copula verb, the equivalent of “to be”. They’re still used to modify a noun, but in a different way.

Again, as with attributives, we can ask, “How verb-like are they?” There’s not too much difference between “the man is eating” and “the man is hungry“, at least as far as word order is concerned, but that’s where the similarities end in English. We can’t have a predicate adjective in the past tense (although we can have a copula in it), but other languages do allow this. For some, predicates are verbs, in essentially every aspect, including agreement markers and other bits of verbal morphology; others allow either option, leaning one way or the other. Strangely enough, the familiar European languages are strict in their avoidance of verbal adjectives, instead preferring copulas.

If a language does permit adjectives to take on the semblance of verbs, then what parts of it? Are they conjugated for tense? Do they have agreement markers? Is every adjective a potential verb, or are only some of them? This last is an interesting notion, as the “split” between verbal predicates and nonverbal ones can be based on any number of factors, a bit like noun gender. A common theme is to allow some adjectives to function as verbs when they represent a temporary state, but require a nonverbal construction when they describe inherent qualities.

Comparison

Since adjectives describe qualities of a noun, it’s natural to want to compare them. Of course, not all of them can be compared; which ones can is different for different languages. In English, it’s largely a matter of semantics: “most optimum”, among others, is considered incorrect or redundant. But most adjectives are comparable. This isn’t the case with every language, however. Some have only a special set of comparable adjectives, and a few have none at all.

Some languages offer degrees of comparison, like English’s “big/bigger/biggest” or “complex/more complex/most complex”. In these cases, the second of the trio is called the comparative, while the third is the superlative. (I don’t know of any languages that have more than three degrees of comparison, but nothing says it’s impossible. Alien conlangers, take note.)

Looking ahead

Determiners are a special class of word that includes articles (like “a” and “the”), demonstratives (“this” and “that”), possessives (“my”, “his”), and a few other odds and ends. They work a bit like adjectives, and older grammars often considered them a subset. But that has fallen out of fashion, and now they’re their own thing. I mention them here partly as a taste of things to come, and as a good lead-in for next time. I’ll talk much more about them in the next theory post, which covers pronouns, since that’s what they seem most like to me.

At this point, we’re done with the “grind” of conlanging. So far, we’ve covered everything from the sounds of a language, to the formation of words, and the three big grammatical categories of noun, verb, and adjective. Sure, we could delve deeper into any of these, and entire textbooks have been written on all of these topics, but we don’t have to worry about that. We can deal with the details as they arise. There’s plenty more to come—we haven’t even begun to look at pronouns or prepositions or even adverbs—but the hardest part, I feel, is behind us. We’re well on our way. Next, we’ll take a look at adjectives in Isian and Ardari, and you’ll get to see the first true sentences in both conlangs, along with a large selection of vocabulary.