SynDev

SynDev is a language created by User:iconmaster whose purpose is to check the syntax of programs in other languages.

Structure
SynDev programs are a list of definitions. Each definition is made of strings, alternations, charsets, and other definition names. Each of these will match a certain string in a text file given to it, going in order.

A definition is written like this: def = item1 item2 item3 ... itemn Where each item is a valid SynDev item.

Strings are a series of characters in double quotes. They literally match whatever is inside them. "STRING"

Alternations are a list of items in square brackets. They will match the first thing in the list that can match. [ thing1 thing2 thing3 ]

Charsets are a series of characters in parenthesis. They will match the first character that matches in the text. You can use % to detonate special character ranges just like in regular expressions. (abc%d)

You can use names of other definitions in the program as well by rererring to thier definition name. In addition, they can have a one-character prefix. *SPC
 * * matches zero or more repetions of the definition.
 * + matches one or more repetions of the definition.
 * ? matches zero or one repetions of the definition.

Note that there are some built-in definitions in SynDev. They are the following:
 * SPC is equal to (%s)
 * QUOT is equal to (")
 * ANY is equal to (%a%A)
 * NEWL is equal to (\n)
 * LTRS is equal to (%w)
 * NUMS is equal to (%d)
 * LTNM is equal to (%a)

Comments begin with a # and continue to the end of a line.
 * 1) this is a comment.

Implementation
The last definition of the program is called the root definition. The root definition is what SynDev looks at first when going into a program. It attempts to match the items in the root definition. If there are definition names, it 'goes into' the definition and attempts to match that. The program returns false if one of the items in the root definition does not match, else it returns True.

Examples
RPL: endchar = (%a%d←↑→↓) varname = +LTRS *endchar string = QUOT *ANY QUOT number = +(%d) prog = "«" *prgpiece "»" list = "{" *item "}" notspc = (%S) funcword = +notspc grob = "GROB" number number ?(%x) alg = "'" *ANY "'" item = [number string alg prog list grob varname funcword] ifthen = "IF" *item "THEN" *item "END" ifelse = "IF" *item "THEN" *item "ELSE" *item "END" if = [ifthen ifelse] startnext = "START" *item "NEXT" startstep = "START" *item "STEP" start = [startnext startstep] fornext = "FOR" varname *item "NEXT" forstep = "FOR" varname *item "STEP" for = [fornext forstep] casepart = "CASE" *item "THEN" *item "END" case = +casepart "END" while = "WHILE" *item "REPEAT" *item "END" do = "DO" *item "UNTIL" *item "END" branch = [if for case start do while] prgpiece = [branch item] program = *prgpiece