Grammar.h header

#include <ew/core/Grammar.h>

Namespace ew::core

Grammar struct

struct ew::core::Grammar

The structured grammar of a constructed language: the typology, constituent order, and modifier placement; the inflection paradigms; the pronouns; and the numberSystem. This supplements – it does not replace – the language's free-form grammar notes (which stay prose); it is the machine-readable part the translator and the reference-grammar export read.

Members

MorphologicalTypology ew::core::Grammar::typology =

The morphological typology.

WordOrder ew::core::Grammar::wordOrder =

The basic constituent order.

ModifierPosition ew::core::Grammar::adjectivePosition =

Where an adjective sits relative to its noun.

QString ew::core::Grammar::notes

Supplementary structured-grammar notes (kept apart from the Language's prose grammar notes).

std::vector<Paradigm> ew::core::Grammar::paradigms

The inflection paradigms (declensions/conjugations).

std::vector<PronounEntry> ew::core::Grammar::pronouns

The personal pronoun set.

NumberSystem ew::core::Grammar::numberSystem

The number system.

bool ew::core::Grammar::isEmpty() const

Whether the grammar carries no structured content (only defaults), so a language can omit it.

const Paradigm * ew::core::Grammar::paradigmFor(const QString &appliesTo) const

The paradigm that applies to appliesTo (part of speech / inflection class), or nullptr.

bool ew::core::Grammar::operator==(const Grammar &other) const =default

Value equality over all fields.

InflectionRule struct

struct ew::core::InflectionRule

One cell of an inflection paradigm: the affixation that realizes a grammatical feature combination on a stem. feature names the combination (e.g. "plural", "genitive.singular"); type and affix say how to build the inflected form from a stem.

Members

QString ew::core::InflectionRule::feature

The grammatical feature combination this rule realizes (e.g. "past", "accusative.plural").

AffixType ew::core::InflectionRule::type =

How the affix attaches.

QString ew::core::InflectionRule::affix

The affix text (a "before|after" pair for a circumfix; the whole word for a replacement).

bool ew::core::InflectionRule::operator==(const InflectionRule &other) const =default

Value equality over all fields.

NumberSystem struct

struct ew::core::NumberSystem

A constructed language's number system: its counting base and the words to build numbers from. The base is the radix (10 = decimal, 20 = vigesimal, 12 = duodecimal); digits gives the words for small values and base powers; formationNote records in prose how compounds are formed.

Members

int ew::core::NumberSystem::base = 10

The counting base / radix (at least 2). 10 is decimal, 20 vigesimal, 12 duodecimal.

QString ew::core::NumberSystem::formationNote

Free-form note on how multi-digit numbers are composed (e.g. "tens-word then ones-word").

std::vector<NumeralDigit> ew::core::NumberSystem::digits

The numeral words, by value (digits 0..base-1 and powers of the base).

QString ew::core::NumberSystem::wordFor(int value) const

The word for value, or an empty string if the system has none.

bool ew::core::NumberSystem::operator==(const NumberSystem &other) const =default

Value equality over all fields.

NumeralDigit struct

struct ew::core::NumeralDigit

One numeral word: a value and the word the language uses for it. A number system lists the words for the digits (0..base-1) and for the powers of the base, from which larger numbers are composed.

Members

int ew::core::NumeralDigit::value = 0

The numeric value this word names (e.g. 0, 1, ... , or a power of the base like 10, 100).

QString ew::core::NumeralDigit::word

The word for that value in the language.

bool ew::core::NumeralDigit::operator==(const NumeralDigit &other) const =default

Value equality over all fields.

Paradigm struct

struct ew::core::Paradigm

A named inflection paradigm: the set of forms a class of words takes across a grammatical dimension (declension for nouns, conjugation for verbs). appliesTo names the part of speech or inflection class the paradigm inflects, so the right paradigm can be found for a word.

Members

QString ew::core::Paradigm::name

The paradigm's display name (e.g. "Regular noun", "Strong verb").

QString ew::core::Paradigm::appliesTo

The part of speech or inflection class this paradigm applies to (e.g. "noun", "a-stem").

std::vector<InflectionRule> ew::core::Paradigm::rules

The paradigm's cells, one per feature combination.

const InflectionRule * ew::core::Paradigm::rule(const QString &feature) const

The rule realizing feature, or nullptr if the paradigm has no cell for it.

bool ew::core::Paradigm::operator==(const Paradigm &other) const =default

Value equality over all fields.

PronounEntry struct

struct ew::core::PronounEntry

One personal pronoun: its form in the language and the person/number/role it stands for. Pronouns are a small closed set worth modelling explicitly rather than as ordinary lexicon entries, so the grammar can lay them out in a paradigm table (person x number, inclusive/exclusive, formality).

Members

QString ew::core::PronounEntry::label

A short feature label (e.g. "1sg", "2pl.formal", "1pl.incl").

QString ew::core::PronounEntry::form

The pronoun as written in the language.

QString ew::core::PronounEntry::gloss

Its meaning/role in the writer's language (e.g. "I", "you (plural, formal)").

bool ew::core::PronounEntry::operator==(const PronounEntry &other) const =default

Value equality over all fields.

Enumerations

enum class AffixType { None, Prefix, Suffix, Circumfix, Replacement }

How an inflectional affix attaches to a stem.

enum class ModifierPosition { BeforeNoun, AfterNoun }

Whether a modifier (adjective, article) precedes or follows the noun it modifies.

enum class MorphologicalTypology { Isolating, Agglutinative, Fusional, Polysynthetic }

The broad morphological typology of a constructed language – how much meaning it packs into a single word, from isolating (one morpheme per word) to polysynthetic (whole clauses in a word). Serialized as a stable lowercase token.

enum class WordOrder { SubjectVerbObject, SubjectObjectVerb, VerbSubjectObject, VerbObjectSubject, ObjectVerbSubject, ObjectSubjectVerb, Free }

The basic order of subject, verb, and object in a clause (the language's constituent order). Serialized as a stable uppercase token (e.g. "SOV").

Functions

std::optional< AffixType > ew::core::affixTypeFromToken(QStringView token)

Parses an affix type from its token; std::nullopt if unrecognized.

std::optional< ModifierPosition > ew::core::modifierPositionFromToken(QStringView token)

Parses a modifier position from its token; std::nullopt if unrecognized.

std::optional< MorphologicalTypology > ew::core::morphologicalTypologyFromToken(QStringView token)

Parses a morphological typology from its token; std::nullopt if unrecognized.

QString ew::core::toToken(MorphologicalTypology typology)

The stable serialization token for typology (e.g. "agglutinative").

QString ew::core::toToken(WordOrder order)

The stable serialization token for order (e.g. "SOV").

QString ew::core::toToken(ModifierPosition position)

The stable serialization token for position (e.g. "before").

QString ew::core::toToken(AffixType type)

The stable serialization token for type (e.g. "suffix").

std::optional< WordOrder > ew::core::wordOrderFromToken(QStringView token)

Parses a word order from its token; std::nullopt if unrecognized.