From b77510eef5fe46127e8a2d24c40a4b5107931d4c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 23 Oct 2014 21:14:14 +0200 Subject: syntax for kbd files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/mds-kbdc.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'src') diff --git a/src/mds-kbdc/mds-kbdc.c b/src/mds-kbdc/mds-kbdc.c index 45a0f88..56cbd42 100644 --- a/src/mds-kbdc/mds-kbdc.c +++ b/src/mds-kbdc/mds-kbdc.c @@ -44,7 +44,78 @@ int main(int argc_, char** argv_) source_code_initialise(&source_code); fail_if (read_source_lines(pathname, &source_code) < 0); + + /* + + information + language "LANGUAGE" # multiple is allowed + country "COUNTRY" # multiple is allowed + variant "VARIANT" + end information + + include "some file" + + function add/3 + \add(\add(\1 \2) \3) + end function + + macro caps_affected/2 + : "\1" + : "\2" + : "\2" + : "\1" + end macro + + : + : "¬" + : # horn + + assumption + have_range "a" "z" + have_range "A" "Z" + have_range "0" "9" + have_chars " !\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~" + have + have + have + have + have + end assumption + + for "A" to "Z" as \1 + "(" "\1" ")" : "\add(\u24B6 \sub(\1 "A"))" + end for + + let \6 : { \and(\4 16) \and(\4 32) \and(\4 64) \and(\4 128) } + + for 0 to 3 as \8 + \set(\6 \8 \add(\rsh(\get(\6 \8) \8) \mul(2 \rsh(\get(\7 \8))))) + end for + + if \and(\1 128) = 128 + let \2 : \or(\2 64) + end if + + \add(a b) # a + b + \sub(a b) # a - b + \mul(a b) # a ⋅ b + \div(a b) # floor[a / b] + \mod(a b) # a mod b + \rsh(a b) # a ⋅ 2 ↑ b + \lsh(a b) # floor[a / 2 ↑ b] + \or(a b) # bitwise + \and(a b) # bitwise + \xor(a b) # bitwise + \not(a) # logical + \equals(a b) # a = b + \greater(a b) # a > b + \less(a b) # a < b + \set(variable index value) + \get(variable index) + + */ + source_code_destroy(&source_code); return 0; pfail: -- cgit v1.2.3-70-g09d2