views:

220

answers:

3

I am trying to get up to speed with Irony. I keep seeing some terminology that I don't yet understand: terminals, non-terminals, token, state machine, Associativity, Abstract Syntax Tree.

Can someone please give some meaning to some of these terms? I keep reading great things about Irony, so any help you can give with learning how to use it would be great.

Edits in bold

+1  A: 

A finite state machine (FSM) or finite state automaton (plural: automata) or simply a state machine, is a model of behavior composed of a finite number of states, transitions between those states, and actions. A finite state machine is an abstract model of a machine with a primitive internal memory.

In English that means that you have a system designed around the concept that your application can be in a finite number of "states" and at any given time. A practical example would be in a game where you are "Playing" or "Paused" or a car that is "On" or "Off". The two states are mutually exclusive and an FSM exists to manage the current state. Generally speaking an FSM is not just one object or class but an overall architectural design where all operations in the application are based on a particular state.

Nathan Taylor
+1 Thanks for info. I don't see how it relates to DSL construction or Irony, but thanks.
Ronnie Overby
Like Matt said, these are all general programming concepts that pertain to more than just Irony. They're important to understand when using Irony simply because they define how it works.
Nathan Taylor
+2  A: 

These terms are not specific to Irony, but are concepts from computer science.

A token is an atomic element of parsing, one which cannot be broken down further when tokenizing. Tokenizing is a subset of lexical analysis. It sounds like you're generally unfamiliar with the theory behind parsing - lots more over at Wikipedia. Good stuff here as well.

Terminals and non-terminals refer to types of tokens. See my 2nd link for details on those.

Edit: an abstract syntax tree is yet another concept in parsing. Since these are all concepts which are not specific to Irony, you can find a lot just by Googling or looking on Wikipedia. Cheers!

Matt Ball
+1 for info
Ronnie Overby
I'm happy to answer more specific questions you have about these concepts if they come up. I've written a few parsers and a couple of compilers, so I have a pretty good working understanding.
Matt Ball
+3  A: 

Associativity is a term from mathematics, and is a property of an operator. An operator o is said to be associative if, for all a, b, and c,

(a o b) o c = a o (b o c)

and thus, as a consequence, the expression a o b o c does not need parentheses to be unambiguous.

For example, the addition operator + is associative over the integers: 1 + 2 + 3 has the same value no matter which order we evaluate the +s in. But the subtraction operator - is not: 1 - 2 - 3 means two different things, depending on which - we evaluate first.

AakashM