Talk:Metasyntax

Latest comment: 9 years ago by Steamerandy in topic Metacompiler metalanguage syntax

Merge "Metasyntax" stub into "Metalanguage" article?

edit

Should this stub be mergerd into the Metalanguage article, or does this precise topic warrant an article of its own?

Stephan Leeds (talk) 13:13, 26 May 2008 (UTC)Reply

Metacompiler metalanguage syntax

edit

META II and its descendants are different then BNF metalanguages. They are programming languages. What is called non terminals in BNF are rules in these languages. A rule is a boolean function returning success or failure. A syntax rule is a test as are strings and symbols. Tokens, symbols and strings, would be terminals. However in CWIC you have programmed token rules.

syntax = $(rule \ char_class \ token);

id     .. let $(let | dgt | '_');
string .. '"' $(~'"') '"' MAKESTR[];

rule      = id "=" sequence ";" :RULE!2 gen_code[*1];
sequence  = test_seq (("\" backtrack:BCK|"/":ALT alternant)!2|.EMPTY);
backtrack = test_seq ("\" backtrack:BCK!2|.EMPTY);
alternant = test_seq ( "/" alternant:ALT!2|.EMPTY);
test_seq  = "(" sequence ")" | <(test | action) $(test | action)>;
test      = string | rule_call;
rule_call = id:CALL ("[" <arg_list> "]"!2 | !1);
action    = (":" id:NODE | "!" number:TREE | "<" sequence ">":LIST)!1;

A symbol or identifier is defined by a token '..' rule. Even let and dgt in the id token rule are defined by a character class rule. SYNTAX and TOKEN rules are boolean functions returning success or failure. Character class rule define tests that are used in other rules. Generally inline code.

dgt: '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9';

These metasyntax metalanguages do not fit the description in artical. Steamerandy (talk) 21:42, 13 December 2014 (UTC)Reply