Transformed yacc c11 grammar into rdp.

Pascal J. Bourguignon [2015-07-21 19:00]
Transformed yacc c11 grammar into rdp.
Filename
languages/c11/actions.lisp
languages/c11/c11-parser.lisp
languages/c11/c11-parser.yacc
languages/c11/c11-scanner.lex
languages/c11/c11-scanner.lisp
languages/c11/c11-yacc.lisp
languages/c11/com.informatimago.languages.c11.asd
languages/c11/context.lisp
languages/c11/packages.lisp
languages/c11/parser.lisp
languages/c11/parser.yacc
languages/c11/read-yacc.lisp
languages/c11/scanner.lex
languages/c11/scanner.lisp
languages/c11/scratch.lisp
languages/linc/com.informatimago.linc.asd
languages/linc/com.informatimago.linc.test.asd
rdp/packages.lisp
rdp/rdp.lisp
diff --git a/languages/c11/actions.lisp b/languages/c11/actions.lisp
index f58cf74..eccc414 100644
--- a/languages/c11/actions.lisp
+++ b/languages/c11/actions.lisp
@@ -32,8 +32,6 @@
 ;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ;;;;**************************************************************************
 (in-package "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER")
-(eval-when (:compile-toplevel :load-toplevel :execute)
-  (setf *readtable* (copy-readtable nil)))


 (defun c-declaration (specifiers init-declarators semicolon)
diff --git a/languages/c11/c11-parser.lisp b/languages/c11/c11-parser.lisp
new file mode 100644
index 0000000..e34ef95
--- /dev/null
+++ b/languages/c11/c11-parser.lisp
@@ -0,0 +1,702 @@
+;;;; -*- mode:lisp;coding:utf-8 -*-
+;;;;**************************************************************************
+;;;;FILE:               c11-parser.lisp
+;;;;LANGUAGE:           Common-Lisp
+;;;;SYSTEM:             Common-Lisp
+;;;;USER-INTERFACE:     NONE
+;;;;DESCRIPTION
+;;;;
+;;;;    C11 parser.
+;;;;
+;;;;AUTHORS
+;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
+;;;;MODIFICATIONS
+;;;;    2015-07-02 <PJB> Created.
+;;;;BUGS
+;;;;LEGAL
+;;;;    AGPL3
+;;;;
+;;;;    Copyright Pascal J. Bourguignon 2015 - 2015
+;;;;
+;;;;    This program is free software: you can redistribute it and/or modify
+;;;;    it under the terms of the GNU Affero General Public License as published by
+;;;;    the Free Software Foundation, either version 3 of the License, or
+;;;;    (at your option) any later version.
+;;;;
+;;;;    This program is distributed in the hope that it will be useful,
+;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;;;    GNU Affero General Public License for more details.
+;;;;
+;;;;    You should have received a copy of the GNU Affero General Public License
+;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;;;;**************************************************************************
+(in-package "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER")
+
+
+(defclass pre-scanned-scanner (scanner)
+  ((tokens :initform '() :initarg :tokens :accessor pre-scanned-tokens))
+  (:default-initargs :source ""))
+
+(defmethod (setf scanner-source) (new-source (scanner pre-scanned-scanner))
+  new-source)
+
+(defmethod scanner-line ((scanner pre-scanned-scanner))
+  (token-line (scanner-current-token scanner)))
+
+(defmethod scanner-column ((scanner pre-scanned-scanner))
+  (token-column (scanner-current-token scanner)))
+
+(defmethod scan-next-token ((scanner pre-scanned-scanner) &optional parser-data)
+  (declare (ignore parser-data))
+  (setf (scanner-current-token scanner) (pop (pre-scanned-tokens scanner))))
+
+(defmethod scanner-end-of-source-p ((scanner pre-scanned-scanner))
+  (null (pre-scanned-tokens scanner)))
+
+(defmethod scanner-end-of-line-p ((scanner pre-scanned-scanner))
+  (scanner-end-of-source-p scanner))
+
+(defmethod advance-line ((scanner pre-scanned-scanner))
+  "RETURN: The new current token = old next token"
+  (if (scanner-end-of-source-p scanner)
+      #|End of File -- don't move.|#
+      nil
+      (scan-next-token scanner)))
+
+(defmethod accept ((scanner scanner) token)
+  (if (word-equal token (token-kind (scanner-current-token scanner)))
+      (prog1 (list (token-kind (scanner-current-token scanner))
+                   (scanner-current-text scanner)
+                   (scanner-column scanner))
+        (scan-next-token scanner))
+      (error 'unexpected-token-error
+             :line   (scanner-line scanner)
+             :column (scanner-column scanner)
+             :scanner scanner
+             :expected-token token
+             :format-control "Expected ~S, not ~A (~S)"
+             :format-arguments (list token
+                                     (token-kind (scanner-current-token scanner))
+                                     (scanner-current-text scanner)))))
+
+;;;---------------------------------------------------------------------
+
+(defgrammar c11
+  ;; rdp
+  :scanner nil
+  :terminals ((|identifier| "identifier")
+              (|typedef_name| "typedef_name")
+              (|func_name| "func_name")
+              (|string_literal| "string_literal")
+              (|i_constant| "i_constant")
+              (|f_constant| "f_constant")
+              (|enum_name| "enum_name")
+              (|alignas| "alignas")
+              (|alignof| "alignof")
+              (|atomic| "atomic")
+              (|generic| "generic")
+              (|noreturn| "noreturn")
+              (|static_assert| "static_assert")
+              (|thread_local| "thread_local")
+              (|case| "case")
+              (|default| "default")
+              (|if| "if")
+              (|else| "else")
+              (|switch| "switch")
+              (|while| "while")
+              (|do| "do")
+              (|for| "for")
+              (|goto| "goto")
+              (|continue| "continue")
+              (|break| "break")
+              (|return| "return")
+              (|struct| "struct")
+              (|union| "union")
+              (|enum| "enum")
+              (|...| "...")
+              (|complex| "complex")
+              (|imaginary| "imaginary")
+              (|bool| "bool")
+              (|char| "char")
+              (|short| "short")
+              (|int| "int")
+              (|long| "long")
+              (|signed| "signed")
+              (|unsigned| "unsigned")
+              (|float| "float")
+              (|double| "double")
+              (|void| "void")
+              (|const| "const")
+              (|restrict| "restrict")
+              (|volatile| "volatile")
+              (|typedef| "typedef")
+              (|extern| "extern")
+              (|static| "static")
+              (|auto| "auto")
+              (|register| "register")
+              (|inline| "inline")
+              (|sizeof| "sizeof")
+              (^= "^=")
+              (\|= "|=")
+              (-= "-=")
+              (<<= "<<=")
+              (>>= ">>=")
+              (&= "&=")
+              (&& "&&")
+              (|\|\|| "||")
+              (*= "*=")
+              (/= "/=")
+              (%= "%=")
+              (+= "+=")
+              (-> "->")
+              (++ "++")
+              (-- "--")
+              (<< "<<")
+              (>> ">>")
+              (<= "<=")
+              (>= ">=")
+              (== "==")
+              (!= "!=")
+              (\( "(")
+              (\) ")")
+              (\, ",")
+              (\: ":")
+              (\; ";")
+              (\. ".")
+              (\[ "[")
+              (\] "]")
+              (\{ "{")
+              (\} "}")
+              (\& "&")
+              (\* "*")
+              (\/ "/")
+              (\+ "+")
+              (\- "-")
+              (\~ "~")
+              (\! "!")
+              (\% "%")
+              (\< "<")
+              (\> ">")
+              (\= "=")
+              (\^ "^")
+              (\| "|")
+              (\? "?")
+              (STAR "*") ;; (seq [ (opt type_qualifier_list) * ])
+              )
+
+  :start |translation_unit|
+  :rules (
+
+          (--> IDENTIFIER     |identifier|)
+          (--> TYPEDEF_NAME   |typedef_name|)
+          (--> FUNC_NAME      |func_name|)
+          (--> STRING_LITERAL |string_literal|)
+          (--> I_CONSTANT     |i_constant|)
+          (--> F_CONSTANT     |f_constant|)
+          (--> ALIGNAS        |alignas|)
+          (--> ALIGNOF        |alignof|)
+          (--> ATOMIC         |atomic|)
+          (--> GENERIC        |generic|)
+          (--> NORETURN       |noreturn|)
+          (--> STATIC_ASSERT  |static_assert|)
+          (--> THREAD_LOCAL   |thread_local|)
+          (--> CASE           |case|)
+          (--> DEFAULT        |default|)
+          (--> IF             |if|)
+          (--> ELSE           |else|)
+          (--> SWITCH         |switch|)
+          (--> WHILE          |while|)
+          (--> DO             |do|)
+          (--> FOR            |for|)
+          (--> GOTO           |goto|)
+          (--> CONTINUE       |continue|)
+          (--> BREAK          |break|)
+          (--> RETURN         |return|)
+          (--> STRUCT         |struct|)
+          (--> UNION          |union|)
+          (--> ENUM           |enum|)
+          (--> ELLIPSIS       |...|)
+          (--> COMPLEX        |complex|)
+          (--> IMAGINARY      |imaginary|)
+          (--> BOOL           |bool|)
+          (--> CHAR           |char|)
+          (--> SHORT          |short|)
+          (--> INT            |int|)
+          (--> LONG           |long|)
+          (--> SIGNED         |signed|)
+          (--> UNSIGNED       |unsigned|)
+          (--> FLOAT          |float|)
+          (--> DOUBLE         |double|)
+          (--> VOID           |void|)
+          (--> CONST          |const|)
+          (--> RESTRICT       |restrict|)
+          (--> VOLATILE       |volatile|)
+          (--> TYPEDEF        |typedef|)
+          (--> EXTERN         |extern|)
+          (--> STATIC         |static|)
+          (--> AUTO           |auto|)
+          (--> REGISTER       |register|)
+          (--> INLINE         |inline|)
+          (--> SIZEOF         |sizeof|)
+          (--> XOR_ASSIGN     ^=)
+          (--> OR_ASSIGN      \|=)
+          (--> SUB_ASSIGN     -=)
+          (--> LEFT_ASSIGN    <<=)
+          (--> RIGHT_ASSIGN   >>=)
+          (--> AND_ASSIGN     &=)
+          (--> AND_OP         &&)
+          (--> OR_OP          |\|\||)
+          (--> MUL_ASSIGN     *=)
+          (--> DIV_ASSIGN     /=)
+          (--> MOD_ASSIGN     %=)
+          (--> ADD_ASSIGN     +=)
+          (--> PTR_OP         ->)
+          (--> INC_OP         ++)
+          (--> DEC_OP         --)
+          (--> LEFT_OP        <<)
+          (--> RIGHT_OP       >>)
+          (--> LE_OP          <=)
+          (--> GE_OP          >=)
+          (--> EQ_OP          ==)
+          (--> NE_OP          !=)
+
+
+          (--> |constant|     (ALT I_CONSTANT     F_CONSTANT))
+          (--> |string|       (ALT STRING_LITERAL FUNC_NAME))
+
+
+          (--> |simple_primary_expression|
+               (ALT IDENTIFIER
+                    |constant|
+                    |string|
+                    |generic_selection|))
+
+          (--> |primary_expression|
+               (ALT |simple_primary_expression|
+                    (SEQ \( |expression| \))))
+
+          (--> |generic_selection|
+               (SEQ GENERIC \( |assignment_expression| \, |generic_assoc_list| \)))
+
+          (--> |generic_assoc_list|
+               (SEQ |generic_association| (REP \, |generic_association|)))
+
+          (--> |generic_association|
+               (ALT (SEQ |type_name| \: |assignment_expression|)
+                    (SEQ DEFAULT \: |assignment_expression|)))
+
+          (--> |postfix_expression|
+               (SEQ |postfix_expression_head| (REP |postfix_expression_item|)))
+
+          (--> |postfix_expression_head|
+               (ALT |simple_primary_expression|
+                    (SEQ \( (ALT (SEQ |expression| \))
+                                 (SEQ |type_name|  \)
+                                      { |initializer_list| (OPT \,)})
+                                 \)))))
+
+          (--> |postfix_expression_item|
+               (ALT (SEQ [ |expression| ])
+                    (SEQ \( (OPT |argument_expression_list|) \))
+                    (SEQ |.| IDENTIFIER)
+                    (SEQ PTR_OP IDENTIFIER)
+                    (SEQ INC_OP)
+                    (SEQ DEC_OP)))
+
+          (--> |argument_expression_list|
+               (SEQ |assignment_expression| (REP \, |assignment_expression|)))
+
+          (--> |simple_unary_expression|
+               (ALT (SEQ INC_OP |unary_expression|)
+                    (SEQ DEC_OP |unary_expression|)
+                    (SEQ |unary_operator| |cast_expression|)
+                    (SEQ SIZEOF |sizeof_argument|)
+                    (SEQ ALIGNOF \( |type_name| \))))
+
+          (--> |sizeof_argument|
+               (ALT (seq |simple_unary_expression|)
+                    (seq (ALT |simple_primary_expression|
+                              (SEQ \( (ALT (SEQ |expression| \))
+                                           (SEQ |type_name| \) (OPT { |initializer_list| (OPT \,)}))
+                                           \))))
+                         (REP |postfix_expression_item|))))
+
+          (--> |unary_expression|
+               (ALT |postfix_expression|
+                    |simple_unary_expression|))
+
+          (--> |unary_operator|
+               (ALT & * + - ~ !))
+
+          (--> |cast_expression|
+               (ALT |simple_unary_expression|
+                    |simple_primary_expression|
+                    (SEQ \( (ALT (SEQ |expression|)
+                                 (SEQ |type_name| \) (ALT (SEQ  { |initializer_list| (OPT \,) })
+                                                          |cast_expression|))\)))))
+
+          (--> |multiplicative_expression|
+               (SEQ |cast_expression| (REP (ALT * / %) |cast_expression|)))
+
+          (--> |additive_expression|
+               (SEQ |multiplicative_expression| (REP (ALT + -) |multiplicative_expression|)))
+
+          (--> |shift_expression|
+               (SEQ |additive_expression| (REP (ALT LEFT_OP RIGHT_OP) |additive_expression|)))
+
+          (--> |relational_expression|
+               (SEQ |shift_expression| (REP (ALT < > LE_OP GE_OP)  |shift_expression|)))
+
+          (--> |equality_expression|
+               (SEQ |relational_expression| (REP (ALT EQ_OP NE_OP) |relational_expression|)))
+
+          (--> |and_expression|
+               (SEQ |equality_expression| (REP & |equality_expression|)))
+
+          (--> |exclusive_or_expression|
+               (SEQ |and_expression| (REP ^ |and_expression|)))
+
+          (--> |inclusive_or_expression|
+               (SEQ |exclusive_or_expression| (REP \| |exclusive_or_expression|)))
+
+          (--> |logical_and_expression|
+               (SEQ |inclusive_or_expression| (REP AND_OP |inclusive_or_expression|)))
+
+          (--> |logical_or_expression|
+               (SEQ |logical_and_expression| (REP OR_OP |logical_and_expression|)))
+
+          (--> |conditional_expression|
+               (SEQ |logical_or_expression| (OPT ? |expression| \: |conditional_expression|)))
+
+          #-(and)
+          (--> |assignment_expression|
+               (ALT |conditional_expression|
+                    (SEQ |unary_expression| |assignment_operator| |assignment_expression|)))
+
+          (--> |assignment_expression|
+               (SEQ |conditional_expression|
+                    (OPT (SEQ |assignment_operator| |assignment_expression|))
+                    :action (progn #|check the conditional_expression is actually unary_expression|#)))
+
+          (--> |assignment_operator|
+               (ALT = MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
+                    XOR_ASSIGN OR_ASSIGN))
+
+          (--> |expression|
+               (SEQ |assignment_expression| (REP \, |assignment_expression|)))
+
+          (--> |constant_expression|
+               |conditional_expression|)
+
+          (--> |declaration|
+               (ALT (SEQ |declaration_specifiers| (OPT |init_declarator_list|) \;)
+                    |static_assert_declaration|))
+
+          (--> |type_qualifier|
+               (ALT CONST RESTRICT VOLATILE ATOMIC))
+
+          (--> |atomic_type_specifier|
+               (SEQ ATOMIC \( |type_name| \)))
+
+          (--> |alignment_specifier|
+               (SEQ ALIGNAS \( (OPT |type_name| |constant_expression|) \)))
+
+          (--> |function_specifier|
+               (ALT INLINE NORETURN))
+
+          (--> |storage_class_specifier|
+               (ALT TYPEDEF EXTERN STATIC THREAD_LOCAL AUTO REGISTER))
+
+          (--> |specifier_qualifier|
+               (ALT CONST
+                    RESTRICT
+                    VOLATILE
+                    (SEQ ATOMIC (OPT \( |type_name| \)))))
+
+          (--> |declaration_specifier|
+               (ALT
+                |alignment_specifier|
+                |function_specifier|
+                |storage_class_specifier|
+                |specifier_qualifier|))
+
+          (--> |declaration_specifiers|
+               (SEQ |declaration_specifier| (REP |declaration_specifier|)))
+
+          (--> |init_declarator_list|
+               (SEQ |init_declarator| (REP \, |init_declarator|)))
+
+          (--> |init_declarator|
+               (SEQ |declarator| (OPT = |initializer|)))
+
+
+          (--> |type_specifier|
+               (ALT VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED BOOL
+                    COMPLEX IMAGINARY
+                    |atomic_type_specifier|
+                    |struct_or_union_specifier|
+                    |enum_specifier|
+                    TYPEDEF_NAME))
+
+          (--> |struct_or_union_specifier|
+               (SEQ |struct_or_union| (ALT (SEQ { |struct_declaration_list| })
+                                           (SEQ IDENTIFIER (OPT { |struct_declaration_list| })) )))
+
+          (--> |struct_or_union|
+               (ALT STRUCT UNION))
+
+          (--> |struct_declaration_list|
+               (SEQ |struct_declaration| (REP  |struct_declaration|)))
+
+          (--> |struct_declaration|
+               (ALT (SEQ |specifier_qualifier_list| (OPT |struct_declarator_list|) \;)
+                    |static_assert_declaration|))
+
+          (--> |specifier_qualifier_list|
+               (SEQ |specifier_qualifier| (REP |specifier_qualifier|)))
+
+          (--> |struct_declarator_list|
+               (SEQ |struct_declarator| (REP \, |struct_declarator|)))
+
+          (--> |struct_declarator|
+               (ALT (SEQ \: |constant_expression|)
+                    (SEQ |declarator| (OPT \: |constant_expression|))))
+
+          (--> |enum_specifier|
+               ENUM (ALT (SEQ { |enumerator_list| (OPT \,)})
+                         (SEQ IDENTIFIER (OPT { |enumerator_list| (OPT \,)})) ))
+
+          (--> |enumerator_list|
+               (SEQ |enumerator| (REP \, |enumerator|)))
+
+          (--> |enumeration_constant|
+               IDENTIFIER)
+
+          (--> |enumerator|
+               (SEQ |enumeration_constant| (OPT = |constant_expression|)))
+
+
+
+
+          (--> |declarator|
+               (SEQ (OPT |pointer|) |direct_declarator|))
+
+          (--> |direct_declarator|
+               (SEQ |simple_direct_declarator|
+                    (REP |direct_declarator_item|)))
+
+          (--> |simple_direct_declarator|
+               (ALT (SEQ IDENTIFIER )
+                    (SEQ \( (OPT (ALT (SEQ |declarator| (REP \, IDENTIFIER)
+                                           :action (progn #|check declarator is identifier
+                                                     if we have rep identifiers.|#))
+                                      (SEQ |parameter_type_list|)))
+                         \))))
+
+          (--> |direct_declarator_item|
+               (ALT (SEQ \( (OPT |direct_declarator_in_parentheses|) \))
+                    (SEQ \[ (OPT (ALT STAR
+                                      |direct_declarator_in_brackets|)) \])))
+
+          (--> |direct_declarator_in_parentheses|
+               (ALT (SEQ |identifier_list|)
+                    (SEQ |parameter_type_list|)))
+
+          (--> |direct_declarator_in_brackets|
+               (ALT (SEQ |assignment_expression|)
+                    (SEQ STATIC (OPT |type_qualifier_list|) |assignment_expression|)
+                    (SEQ |type_qualifier_list| (OPT (ALT ;; * ;; TODO
+                                                         (SEQ (OPT STATIC) |assignment_expression|))))))
+
+
+
+          (--> |parameter_type_list|
+               (SEQ |parameter_list| (OPT \, ELLIPSIS)))
+
+          (--> |parameter_list|
+               |parameter_declaration| (REP \, |parameter_declaration|))
+
+          (--> |identifier_list|
+               (SEQ IDENTIFIER (REP \, IDENTIFIER)))
+
+          (--> |type_qualifier_list|
+               |type_qualifier| (REP |type_qualifier|))
+
+
+
+
+
+
+          (--> |parameter_declaration|
+               (SEQ |declaration_specifiers|
+                    (OPT |declarator__or__abstract_declarator|)))
+
+          (--> |declarator__or__abstract_declarator|
+               (alt |direct_declarator__or__direct_abstract_declarator|
+                    (seq |pointer| (opt |direct_declarator__or__direct_abstract_declarator|))))
+
+          (--> |direct_declarator__or__direct_abstract_declarator|
+               (seq |simple_direct_declarator__or__simple_direct_abstract_declarator|
+                    (rep |direct_declarator_item__or__direct_abstract_declarator_item|)))
+
+
+          (--> |simple_direct_declarator__or__simple_direct_abstract_declarator|
+               (ALT (SEQ IDENTIFIER)
+                    (SEQ \( (OPT (ALT (seq |declarator__or__abstract_declarator|
+                                           (REP \, IDENTIFIER)
+                                           :action (progn #|check declarator is identifier
+                                                     if we have rep identifiers.|#))
+                                      (seq |parameter_type_list|)))
+                         \))
+                    |bracket_direct_abstract_declarator|))
+
+          (--> |direct_declarator_item__or__direct_abstract_declarator_item|
+               (ALT (SEQ \( (OPT |direct_declarator_in_parentheses|) \))
+                    |bracket_direct_abstract_declarator|))
+
+          (--> |bracket_direct_abstract_declarator|
+               (SEQ \[
+                    (OPT (ALT (SEQ STAR)
+                              (SEQ |direct_declarator_in_brackets|
+                                   :action (progn #| check no [*] |#))))
+                    \]))
+
+
+
+
+
+          (--> |pointer|
+               (SEQ * (OPT (ALT (SEQ |type_qualifier_list| (OPT |pointer|))
+                                |pointer|))))
+
+
+          (--> |type_name|
+               (SEQ |specifier_qualifier_list| (OPT |abstract_declarator|)))
+
+
+
+
+
+          (--> |abstract_declarator|
+               (ALT (SEQ |pointer| (OPT |direct_abstract_declarator|))
+                    (SEQ |direct_abstract_declarator|)))
+
+          (--> |direct_abstract_declarator|
+               (SEQ |simple_direct_abstract_declarator|
+                    (REP |direct_abstract_declarator_item|)))
+
+          (--> |simple_direct_abstract_declarator|
+               (ALT (SEQ \( (OPT |direct_abstract_declarator_in_parentheses|) \))
+                    |bracket_direct_abstract_declarator|))
+
+          (--> |direct_abstract_declarator_in_parentheses|
+               (ALT (SEQ |abstract_declarator|)
+                    (SEQ |parameter_type_list|)))
+
+          (--> |direct_abstract_declarator_item|
+               (ALT (SEQ \( (OPT |parameter_type_list|) \))
+                    |bracket_direct_abstract_declarator|))
+
+
+
+
+
+
+          (--> |initializer|
+               (ALT (SEQ { |initializer_list| (OPT \,)})
+                    |assignment_expression|))
+
+          (--> |initializer_list|
+               (SEQ (ALT (SEQ |designation| |initializer|)
+                         (SEQ |initializer|))
+                    (REP \, |initializer_list|)))
+
+          (--> |designation|
+               (SEQ |designator_list| =))
+
+          (--> |designator_list|
+               |designator| (REP |designator|))
+
+          (--> |designator|
+               (ALT (SEQ [ |constant_expression| ])
+                    (SEQ |.| IDENTIFIER)))
+
+          (--> |static_assert_declaration|
+               (SEQ STATIC_ASSERT \( |constant_expression| \, STRING_LITERAL \) \;))
+
+          (--> |statement|
+               (ALT |simple_labeled_statement|
+                    |expression_statement_or_label|
+                    |compound_statement|
+                    |selection_statement|
+                    |iteration_statement|
+                    |jump_statement|))
+
+
+          (--> |expression_statement_or_label|
+               (ALT \;
+                    (SEQ |expression| (ALT (SEQ \;) ; expression_statement
+                                           (SEQ \: |statement|))))) ; label
+
+          (--> |expression_statement|
+               (ALT \;
+                    (SEQ |expression| \;)))
+
+          (--> |simple_labeled_statement|
+               (ALT (SEQ CASE |constant_expression| \: |statement|)
+                    (SEQ DEFAULT \: |statement|)))
+
+          (--> |compound_statement|
+               (SEQ { (OPT |block_item_list|) }))
+
+          (--> |block_item_list|
+               |block_item| (REP |block_item|))
+
+          (--> |block_item|
+               (ALT |declaration|
+                    |statement|))
+
+
+          (--> |selection_statement|
+               (ALT (SEQ IF \( |expression| \) |statement| (OPT ELSE |statement|))
+                    (SEQ SWITCH \( |expression| \) |statement|)))
+
+          (--> |iteration_statement|
+               (ALT (SEQ WHILE \( |expression| \) |statement|)
+                    (SEQ DO |statement| WHILE \( |expression| \) \;)
+                    (SEQ FOR \( (ALT (SEQ |expression_statement|  |expression_statement|  (OPT  |expression|)  \) |statement|)
+                                     (SEQ |declaration| |expression_statement| (OPT |expression|) \) |statement|)))))
+
+          (--> |jump_statement|
+               (ALT (SEQ GOTO IDENTIFIER \;)
+                    (SEQ CONTINUE \;)
+                    (SEQ BREAK \;)
+                    (SEQ RETURN (OPT  |expression|) \;)))
+
+          (--> |translation_unit|
+               (SEQ |external_declaration| (REP |external_declaration|)))
+
+          (--> |external_declaration|
+               (ALT |static_assert_declaration|
+                    (SEQ |declaration_specifiers|
+                         |declarator|
+                         (ALT
+                          (SEQ = |initializer| (REP \, |init_declarator|) \;) ; declaration
+                          (SEQ (OPT |declaration_list|) ; function_definition
+                               |compound_statement|)
+                          ))))
+
+
+          (--> |declaration_list|
+               (SEQ  |declaration| (REP |declaration|)))))
+
+
+(defun test/parse-stream (tokens)
+  (let ((*scanner* (make-instance 'pre-scanned-scanner :tokens tokens)))
+    (loop
+      :until (scanner-end-of-source-p *scanner*)
+      :collect  (parse-c11 *scanner*))))
+
+
+;;;; THE END ;;;;
diff --git a/languages/c11/c11-parser.yacc b/languages/c11/c11-parser.yacc
new file mode 100644
index 0000000..bb3ac7a
--- /dev/null
+++ b/languages/c11/c11-parser.yacc
@@ -0,0 +1,544 @@
+/*  Note: There are two shift/reduce conflicts, correctly resolved by default: */
+/*                                                                             */
+/*   IF '(' expression ')' statement _ ELSE statement                          */
+/*                                                                             */
+/* and                                                                         */
+/*                                                                             */
+/*   ATOMIC _ '(' type_name ')'                                                */
+/*                                                                             */
+/* where "_" has been used to flag the points of ambiguity.                    */
+
+%token	IDENTIFIER I_CONSTANT F_CONSTANT STRING_LITERAL FUNC_NAME SIZEOF
+%token	PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
+%token	AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
+%token	SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
+%token	XOR_ASSIGN OR_ASSIGN
+%token	TYPEDEF_NAME ENUMERATION_CONSTANT
+
+%token	TYPEDEF EXTERN STATIC AUTO REGISTER INLINE
+%token	CONST RESTRICT VOLATILE
+%token	BOOL CHAR SHORT INT LONG SIGNED UNSIGNED FLOAT DOUBLE VOID
+%token	COMPLEX IMAGINARY
+%token	STRUCT UNION ENUM ELLIPSIS
+
+%token	CASE DEFAULT IF ELSE SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
+
+%token	ALIGNAS ALIGNOF ATOMIC GENERIC NORETURN STATIC_ASSERT THREAD_LOCAL
+
+%start translation_unit
+%%
+
+primary_expression
+	: IDENTIFIER
+	| constant
+	| string
+	| '(' expression ')'
+	| generic_selection
+	;
+
+constant
+	: I_CONSTANT		/* includes character_constant */
+	| F_CONSTANT
+	| ENUMERATION_CONSTANT	/* after it has been defined as such */
+	;
+
+enumeration_constant		/* before it has been defined as such */
+	: IDENTIFIER
+	;
+
+string
+	: STRING_LITERAL
+	| FUNC_NAME
+	;
+
+generic_selection
+	: GENERIC '(' assignment_expression ',' generic_assoc_list ')'
+	;
+
+generic_assoc_list
+	: generic_association
+	| generic_assoc_list ',' generic_association
+	;
+
+generic_association
+	: type_name ':' assignment_expression
+	| DEFAULT ':' assignment_expression
+	;
+
+postfix_expression
+	: primary_expression
+	| postfix_expression '[' expression ']'
+	| postfix_expression '(' ')'
+	| postfix_expression '(' argument_expression_list ')'
+	| postfix_expression '.' IDENTIFIER
+	| postfix_expression PTR_OP IDENTIFIER
+	| postfix_expression INC_OP
+	| postfix_expression DEC_OP
+	| '(' type_name ')' '{' initializer_list '}'
+	| '(' type_name ')' '{' initializer_list ',' '}'
+	;
+
+argument_expression_list
+	: assignment_expression
+	| argument_expression_list ',' assignment_expression
+	;
+
+unary_expression
+	: postfix_expression
+	| INC_OP unary_expression
+	| DEC_OP unary_expression
+	| unary_operator cast_expression
+	| SIZEOF unary_expression
+	| SIZEOF '(' type_name ')'
+	| ALIGNOF '(' type_name ')'
+	;
+
+unary_operator
+	: '&'
+	| '*'
+	| '+'
+	| '-'
+	| '~'
+	| '!'
+	;
+
+cast_expression
+	: unary_expression
+	| '(' type_name ')' cast_expression
+	;
+
+multiplicative_expression
+	: cast_expression
+	| multiplicative_expression '*' cast_expression
+	| multiplicative_expression '/' cast_expression
+	| multiplicative_expression '%' cast_expression
+	;
+
+additive_expression
+	: multiplicative_expression
+	| additive_expression '+' multiplicative_expression
+	| additive_expression '-' multiplicative_expression
+	;
+
+shift_expression
+	: additive_expression
+	| shift_expression LEFT_OP additive_expression
+	| shift_expression RIGHT_OP additive_expression
+	;
+
+relational_expression
+	: shift_expression
+	| relational_expression '<' shift_expression
+	| relational_expression '>' shift_expression
+	| relational_expression LE_OP shift_expression
+	| relational_expression GE_OP shift_expression
+	;
+
+equality_expression
+	: relational_expression
+	| equality_expression EQ_OP relational_expression
+	| equality_expression NE_OP relational_expression
+	;
+
+and_expression
+	: equality_expression
+	| and_expression '&' equality_expression
+	;
+
+exclusive_or_expression
+	: and_expression
+	| exclusive_or_expression '^' and_expression
+	;
+
+inclusive_or_expression
+	: exclusive_or_expression
+	| inclusive_or_expression '|' exclusive_or_expression
+	;
+
+logical_and_expression
+	: inclusive_or_expression
+	| logical_and_expression AND_OP inclusive_or_expression
+	;
+
+logical_or_expression
+	: logical_and_expression
+	| logical_or_expression OR_OP logical_and_expression
+	;
+
+conditional_expression
+	: logical_or_expression
+	| logical_or_expression '?' expression ':' conditional_expression
+	;
+
+assignment_expression
+	: conditional_expression
+	| unary_expression assignment_operator assignment_expression
+	;
+
+assignment_operator
+	: '='
+	| MUL_ASSIGN
+	| DIV_ASSIGN
+	| MOD_ASSIGN
+	| ADD_ASSIGN
+	| SUB_ASSIGN
+	| LEFT_ASSIGN
+	| RIGHT_ASSIGN
+	| AND_ASSIGN
+	| XOR_ASSIGN
+	| OR_ASSIGN
+	;
+
+expression
+	: assignment_expression
+	| expression ',' assignment_expression
+	;
+
+constant_expression
+	: conditional_expression	/* with constraints */
+	;
+
+declaration
+	: declaration_specifiers ';'
+	| declaration_specifiers init_declarator_list ';'
+	| static_assert_declaration
+	;
+
+declaration_specifiers
+	: storage_class_specifier declaration_specifiers
+	| storage_class_specifier
+	| type_specifier declaration_specifiers
+	| type_specifier
+	| type_qualifier declaration_specifiers
+	| type_qualifier
+	| function_specifier declaration_specifiers
+	| function_specifier
+	| alignment_specifier declaration_specifiers
+	| alignment_specifier
+	;
+
+init_declarator_list
+	: init_declarator
+	| init_declarator_list ',' init_declarator
+	;
+
+init_declarator
+	: declarator '=' initializer
+	| declarator
+	;
+
+storage_class_specifier
+	: TYPEDEF	/* identifiers must be flagged as TYPEDEF_NAME */
+	| EXTERN
+	| STATIC
+	| THREAD_LOCAL
+	| AUTO
+	| REGISTER
+	;
+
+type_specifier
+	: VOID
+	| CHAR
+	| SHORT
+	| INT
+	| LONG
+	| FLOAT
+	| DOUBLE
+	| SIGNED
+	| UNSIGNED
+	| BOOL
+	| COMPLEX
+	| IMAGINARY	  	/* non-mandated extension */
+	| atomic_type_specifier
+	| struct_or_union_specifier
+	| enum_specifier
+	| TYPEDEF_NAME		/* after it has been defined as such */
+	;
+
+struct_or_union_specifier
+	: struct_or_union '{' struct_declaration_list '}'
+	| struct_or_union IDENTIFIER '{' struct_declaration_list '}'
+	| struct_or_union IDENTIFIER
+	;
+
+struct_or_union
+	: STRUCT
+	| UNION
+	;
+
+struct_declaration_list
+	: struct_declaration
+	| struct_declaration_list struct_declaration
+	;
+
+struct_declaration
+	: specifier_qualifier_list ';'	/* for anonymous struct/union */
+	| specifier_qualifier_list struct_declarator_list ';'
+	| static_assert_declaration
+	;
+
+specifier_qualifier_list
+	: type_specifier specifier_qualifier_list
+	| type_specifier
+	| type_qualifier specifier_qualifier_list
+	| type_qualifier
+	;
+
+struct_declarator_list
+	: struct_declarator
+	| struct_declarator_list ',' struct_declarator
+	;
+
+struct_declarator
+	: ':' constant_expression
+	| declarator ':' constant_expression
+	| declarator
+	;
+
+enum_specifier
+	: ENUM '{' enumerator_list '}'
+	| ENUM '{' enumerator_list ',' '}'
+	| ENUM IDENTIFIER '{' enumerator_list '}'
+	| ENUM IDENTIFIER '{' enumerator_list ',' '}'
+	| ENUM IDENTIFIER
+	;
+
+enumerator_list
+	: enumerator
+	| enumerator_list ',' enumerator
+	;
+
+enumerator	/* identifiers must be flagged as ENUMERATION_CONSTANT */
+	: enumeration_constant '=' constant_expression
+	| enumeration_constant
+	;
+
+atomic_type_specifier
+	: ATOMIC '(' type_name ')'
+	;
+
+type_qualifier
+	: CONST
+	| RESTRICT
+	| VOLATILE
+	| ATOMIC
+	;
+
+function_specifier
+	: INLINE
+	| NORETURN
+	;
+
+alignment_specifier
+	: ALIGNAS '(' type_name ')'
+	| ALIGNAS '(' constant_expression ')'
+	;
+
+declarator
+	: pointer direct_declarator
+	| direct_declarator
+	;
+
+direct_declarator
+	: IDENTIFIER
+	| '(' declarator ')'
+	| direct_declarator '[' ']'
+	| direct_declarator '[' '*' ']'
+	| direct_declarator '[' STATIC type_qualifier_list assignment_expression ']'
+	| direct_declarator '[' STATIC assignment_expression ']'
+	| direct_declarator '[' type_qualifier_list '*' ']'
+	| direct_declarator '[' type_qualifier_list STATIC assignment_expression ']'
+	| direct_declarator '[' type_qualifier_list assignment_expression ']'
+	| direct_declarator '[' type_qualifier_list ']'
+	| direct_declarator '[' assignment_expression ']'
+	| direct_declarator '(' parameter_type_list ')'
+	| direct_declarator '(' ')'
+	| direct_declarator '(' identifier_list ')'
+	;
+
+pointer
+	: '*' type_qualifier_list pointer
+	| '*' type_qualifier_list
+	| '*' pointer
+	| '*'
+	;
+
+type_qualifier_list
+	: type_qualifier
+	| type_qualifier_list type_qualifier
+	;
+
+
+parameter_type_list
+	: parameter_list ',' ELLIPSIS
+	| parameter_list
+	;
+
+parameter_list
+	: parameter_declaration
+	| parameter_list ',' parameter_declaration
+	;
+
+parameter_declaration
+	: declaration_specifiers declarator
+	| declaration_specifiers abstract_declarator
+	| declaration_specifiers
+	;
+
+identifier_list
+	: IDENTIFIER
+	| identifier_list ',' IDENTIFIER
+	;
+
+type_name
+	: specifier_qualifier_list abstract_declarator
+	| specifier_qualifier_list
+	;
+
+abstract_declarator
+	: pointer direct_abstract_declarator
+	| pointer
+	| direct_abstract_declarator
+	;
+
+direct_abstract_declarator
+	: '(' abstract_declarator ')'
+	| '[' ']'
+	| '[' '*' ']'
+	| '[' STATIC type_qualifier_list assignment_expression ']'
+	| '[' STATIC assignment_expression ']'
+	| '[' type_qualifier_list STATIC assignment_expression ']'
+	| '[' type_qualifier_list assignment_expression ']'
+	| '[' type_qualifier_list ']'
+	| '[' assignment_expression ']'
+	| direct_abstract_declarator '[' ']'
+	| direct_abstract_declarator '[' '*' ']'
+	| direct_abstract_declarator '[' STATIC type_qualifier_list assignment_expression ']'
+	| direct_abstract_declarator '[' STATIC assignment_expression ']'
+	| direct_abstract_declarator '[' type_qualifier_list assignment_expression ']'
+	| direct_abstract_declarator '[' type_qualifier_list STATIC assignment_expression ']'
+	| direct_abstract_declarator '[' type_qualifier_list ']'
+	| direct_abstract_declarator '[' assignment_expression ']'
+	| '(' ')'
+	| '(' parameter_type_list ')'
+	| direct_abstract_declarator '(' ')'
+	| direct_abstract_declarator '(' parameter_type_list ')'
+	;
+
+initializer
+	: '{' initializer_list '}'
+	| '{' initializer_list ',' '}'
+	| assignment_expression
+	;
+
+initializer_list
+	: designation initializer
+	| initializer
+	| initializer_list ',' designation initializer
+	| initializer_list ',' initializer
+	;
+
+designation
+	: designator_list '='
+	;
+
+designator_list
+	: designator
+	| designator_list designator
+	;
+
+designator
+	: '[' constant_expression ']'
+	| '.' IDENTIFIER
+	;
+
+static_assert_declaration
+	: STATIC_ASSERT '(' constant_expression ',' STRING_LITERAL ')' ';'
+	;
+
+statement
+	: labeled_statement
+	| compound_statement
+	| expression_statement
+	| selection_statement
+	| iteration_statement
+	| jump_statement
+	;
+
+labeled_statement
+	: IDENTIFIER ':' statement
+	| CASE constant_expression ':' statement
+	| DEFAULT ':' statement
+	;
+
+compound_statement
+	: '{' '}'
+	| '{'  block_item_list '}'
+	;
+
+block_item_list
+	: block_item
+	| block_item_list block_item
+	;
+
+block_item
+	: declaration
+	| statement
+	;
+
+expression_statement
+	: ';'
+	| expression ';'
+	;
+
+selection_statement
+	: IF '(' expression ')' statement ELSE statement
+	| IF '(' expression ')' statement
+	| SWITCH '(' expression ')' statement
+	;
+
+iteration_statement
+	: WHILE '(' expression ')' statement
+	| DO statement WHILE '(' expression ')' ';'
+	| FOR '(' expression_statement expression_statement ')' statement
+	| FOR '(' expression_statement expression_statement expression ')' statement
+	| FOR '(' declaration expression_statement ')' statement
+	| FOR '(' declaration expression_statement expression ')' statement
+	;
+
+jump_statement
+	: GOTO IDENTIFIER ';'
+	| CONTINUE ';'
+	| BREAK ';'
+	| RETURN ';'
+	| RETURN expression ';'
+	;
+
+translation_unit
+	: external_declaration
+	| translation_unit external_declaration
+	;
+
+external_declaration
+	: function_definition
+	| declaration
+	;
+
+function_definition
+	: declaration_specifiers declarator declaration_list compound_statement
+	| declaration_specifiers declarator compound_statement
+	;
+
+declaration_list
+	: declaration
+	| declaration_list declaration
+	;
+
+%%
+#include <stdio.h>
+
+void yyerror(const char *s)
+{
+	fflush(stdout);
+	fprintf(stderr, "*** %s\n", s);
+}
diff --git a/languages/c11/c11-scanner.lex b/languages/c11/c11-scanner.lex
new file mode 100644
index 0000000..0baead6
--- /dev/null
+++ b/languages/c11/c11-scanner.lex
@@ -0,0 +1,176 @@
+
+D			[0-9]
+L			[a-zA-Z_]
+H			[a-fA-F0-9]
+E			[Ee][+-]?{D}+
+FS			(f|F|l|L)
+IS			(u|U|l|L)*
+
+%{
+#include <stdio.h>
+#include "y.tab.h"
+
+void count();
+%}
+
+%%
+"/*"			{ comment(); }
+
+"auto"			{ count(); return(AUTO); }
+"break"			{ count(); return(BREAK); }
+"case"			{ count(); return(CASE); }
+"char"			{ count(); return(CHAR); }
+"const"			{ count(); return(CONST); }
+"continue"		{ count(); return(CONTINUE); }
+"default"		{ count(); return(DEFAULT); }
+"do"			{ count(); return(DO); }
+"double"		{ count(); return(DOUBLE); }
+"else"			{ count(); return(ELSE); }
+"enum"			{ count(); return(ENUM); }
+"extern"		{ count(); return(EXTERN); }
+"float"			{ count(); return(FLOAT); }
+"for"			{ count(); return(FOR); }
+"goto"			{ count(); return(GOTO); }
+"if"			{ count(); return(IF); }
+"int"			{ count(); return(INT); }
+"long"			{ count(); return(LONG); }
+"register"		{ count(); return(REGISTER); }
+"return"		{ count(); return(RETURN); }
+"short"			{ count(); return(SHORT); }
+"signed"		{ count(); return(SIGNED); }
+"sizeof"		{ count(); return(SIZEOF); }
+"static"		{ count(); return(STATIC); }
+"struct"		{ count(); return(STRUCT); }
+"switch"		{ count(); return(SWITCH); }
+"typedef"		{ count(); return(TYPEDEF); }
+"union"			{ count(); return(UNION); }
+"unsigned"		{ count(); return(UNSIGNED); }
+"void"			{ count(); return(VOID); }
+"volatile"		{ count(); return(VOLATILE); }
+"while"			{ count(); return(WHILE); }
+
+{L}({L}|{D})*		{ count(); return(check_type()); }
+
+0[xX]{H}+{IS}?		{ count(); return(CONSTANT); }
+0{D}+{IS}?		{ count(); return(CONSTANT); }
+{D}+{IS}?		{ count(); return(CONSTANT); }
+L?'(\\.|[^\\'])+'	{ count(); return(CONSTANT); } /* ' */
+
+{D}+{E}{FS}?		{ count(); return(CONSTANT); }
+{D}*"."{D}+({E})?{FS}?	{ count(); return(CONSTANT); }
+{D}+"."{D}*({E})?{FS}?	{ count(); return(CONSTANT); }
+
+L?\"(\\.|[^\\"])*\"	{ count(); return(STRING_LITERAL); } /* " */
+
+"..."			{ count(); return(ELLIPSIS); }
+">>="			{ count(); return(RIGHT_ASSIGN); }
+"<<="			{ count(); return(LEFT_ASSIGN); }
+"+="			{ count(); return(ADD_ASSIGN); }
+"-="			{ count(); return(SUB_ASSIGN); }
+"*="			{ count(); return(MUL_ASSIGN); }
+"/="			{ count(); return(DIV_ASSIGN); }
+"%="			{ count(); return(MOD_ASSIGN); }
+"&="			{ count(); return(AND_ASSIGN); }
+"^="			{ count(); return(XOR_ASSIGN); }
+"|="			{ count(); return(OR_ASSIGN); }
+">>"			{ count(); return(RIGHT_OP); }
+"<<"			{ count(); return(LEFT_OP); }
+"++"			{ count(); return(INC_OP); }
+"--"			{ count(); return(DEC_OP); }
+"->"			{ count(); return(PTR_OP); }
+"&&"			{ count(); return(AND_OP); }
+"||"			{ count(); return(OR_OP); }
+"<="			{ count(); return(LE_OP); }
+">="			{ count(); return(GE_OP); }
+"=="			{ count(); return(EQ_OP); }
+"!="			{ count(); return(NE_OP); }
+";"			{ count(); return(';'); }
+("{"|"<%")		{ count(); return('{'); }
+("}"|"%>")		{ count(); return('}'); }
+","			{ count(); return(','); }
+":"			{ count(); return(':'); }
+"="			{ count(); return('='); }
+"("			{ count(); return('('); }
+")"			{ count(); return(')'); }
+("["|"<:")		{ count(); return('['); }
+("]"|":>")		{ count(); return(']'); }
+"."			{ count(); return('.'); }
+"&"			{ count(); return('&'); }
+"!"			{ count(); return('!'); }
+"~"			{ count(); return('~'); }
+"-"			{ count(); return('-'); }
+"+"			{ count(); return('+'); }
+"*"			{ count(); return('*'); }
+"/"			{ count(); return('/'); }
+"%"			{ count(); return('%'); }
+"<"			{ count(); return('<'); }
+">"			{ count(); return('>'); }
+"^"			{ count(); return('^'); }
+"|"			{ count(); return('|'); }
+"?"			{ count(); return('?'); }
+
+[ \t\v\n\f]		{ count(); }
+.			{ /* ignore bad characters */ }
+
+%%
+
+yywrap()
+{
+	return(1);
+}
+
+
+comment()
+{
+	char c, c1;
+
+loop:
+	while ((c = input()) != '*' && c != 0)
+		putchar(c);
+
+	if ((c1 = input()) != '/' && c != 0)
+	{
+		unput(c1);
+		goto loop;
+	}
+
+	if (c != 0)
+		putchar(c1);
+}
+
+
+int column = 0;
+
+void count()
+{
+	int i;
+
+	for (i = 0; yytext[i] != '\0'; i++)
+		if (yytext[i] == '\n')
+			column = 0;
+		else if (yytext[i] == '\t')
+			column += 8 - (column % 8);
+		else
+			column++;
+
+	ECHO;
+}
+
+
+int check_type()
+{
+/*
+* pseudo code --- this is what it should check
+*
+*	if (yytext == type_name)
+*		return(TYPE_NAME);
+*
+*	return(IDENTIFIER);
+*/
+
+/*
+*	it actually will only return IDENTIFIER
+*/
+
+	return(IDENTIFIER);
+}
diff --git a/languages/c11/c11-scanner.lisp b/languages/c11/c11-scanner.lisp
new file mode 100644
index 0000000..0edb8ce
--- /dev/null
+++ b/languages/c11/c11-scanner.lisp
@@ -0,0 +1,123 @@
+;;;; -*- mode:lisp;coding:utf-8 -*-
+;;;;**************************************************************************
+;;;;FILE:               c11-scanner.lisp
+;;;;LANGUAGE:           Common-Lisp
+;;;;SYSTEM:             Common-Lisp
+;;;;USER-INTERFACE:     NONE
+;;;;DESCRIPTION
+;;;;
+;;;;    C11 Scanner.
+;;;;
+;;;;AUTHORS
+;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
+;;;;MODIFICATIONS
+;;;;    2015-07-02 <PJB> Created.
+;;;;BUGS
+;;;;LEGAL
+;;;;    AGPL3
+;;;;
+;;;;    Copyright Pascal J. Bourguignon 2015 - 2015
+;;;;
+;;;;    This program is free software: you can redistribute it and/or modify
+;;;;    it under the terms of the GNU Affero General Public License as published by
+;;;;    the Free Software Foundation, either version 3 of the License, or
+;;;;    (at your option) any later version.
+;;;;
+;;;;    This program is distributed in the hope that it will be useful,
+;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;;;    GNU Affero General Public License for more details.
+;;;;
+;;;;    You should have received a copy of the GNU Affero General Public License
+;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;;;;**************************************************************************
+(in-package "COM.INFORMATIMAGO.LANGUAGES.C11.SCANNER")
+
+(define-scanner c11-scanner
+  :terminals  (
+               "!" "!=" "%" "%=" "%>" "&" "&&" "&=" "(" ")"
+               "*" "*=" "+" "++" "+=" "," "-" "--" "-=" "->" "." "..."
+               "/" "/=" ":" ":>" ";" "<" "<%" "<:" "<<" "<<=" "<=" "="
+               "==" ">" ">=" ">>" ">>=" "?" "[" "]" "^" "^=" "_Bool"
+               "_Complex" "_Imaginary" "__asm__" "__builtin_va_list"
+               "__const" "__inline" "__inline__" "__restrict" "asm"
+               "auto" "break" "case" "char" "const" "continue"
+               "default" "do" "double" "else" "enum" "extern" "float"
+               "for" "goto" "if" "inline" "int" "long" "register"
+               "restrict" "return" "short" "signed" "sizeof" "static"
+               "struct" "switch" "typedef" "union" "unsigned" "void"
+               "volatile" "while" "{" "|" "|=" "||" "}" "~" "~="
+               (identifier "[a-zA-Z_$][a-zA-Z_$0-9]*")
+               (hex        "0[xX][0-9A-Fa-f]+[uUlL]*")
+               (oct        "0[0-7]+[uUlL]*")
+               (dec        "[0-9]+[uUlL]*")
+               (lchar      "L?'(\\.|[^\\'])+'")
+               (flt1       "[0-9]+[Ee][-+]?[0-9]+[fFlL]?")
+               (flt2       "[0-9]*\\.[0-9]+([Ee][-+]?[0-9]+)?[fFlL]?")
+               (flt3       "[0-9]+\\.[0-9]*([Ee][-+]?[0-9]+)?[fFlL]?")
+               (str        "L?\"(\\.|[^\\\"])*\""))
+  :alphanumerics "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$"
+  :spaces (load-time-value  (coerce (remove-duplicates
+                                     '(#\Space
+                                       #\Newline
+                                       #+has-tab     #\Tab
+                                       #+has-page    #\Page
+                                       #+has-null    #\Null
+                                       #+(and has-return   (not newline-is-return))   #\Return
+                                       #+(and has-linefeed (not newline-is-linefeed)) #\Linefeed))
+                                    'string)))
+
+
+(defparameter *c11-literal-tokens*
+  '("!" "!=" "%" "%=" "%>" "&" "&&" "&=" "(" ")"
+    "*" "*=" "+" "++" "+=" "," "-" "--" "-=" "->" "." "..."
+    "/" "/=" ":" ":>" ";" "<" "<%" "<:" "<<" "<<=" "<=" "="
+    "==" ">" ">=" ">>" ">>=" "?" "[" "]" "^" "^=" "_Bool"
+    "_Complex" "_Imaginary" "__asm__" "__builtin_va_list"
+    "__const" "__inline" "__inline__" "__restrict" "asm"
+    "auto" "break" "case" "char" "const" "continue"
+    "default" "do" "double" "else" "enum" "extern" "float"
+    "for" "goto" "if" "inline" "int" "long" "register"
+    "restrict" "return" "short" "signed" "sizeof" "static"
+    "struct" "switch" "typedef" "union" "unsigned" "void"
+    "volatile" "while" "{" "|" "|=" "||" "}" "~" "~="))
+
+(defparameter *c11-literal-tokens-map*
+  (let ((table (make-hash-table :test 'equal)))
+    (dolist (token *c11-literal-tokens* table)
+      (setf (gethash token table) (intern token)))))
+
+(defparameter *c11-regexp-tokens*
+  ;; order matters
+  '((|string_literal|
+     (str        "L?\"(\\.|[^\\\"])*\""))
+    (|i_constant|
+     (lchar      "L?'(\\.|[^\\'])+'"))
+    (|identifier|
+     (identifier "[a-zA-Z_$][a-zA-Z_$0-9]*"))
+    (|f_constant|
+     (flt1       "[0-9]+[Ee][-+]?[0-9]+[fFlL]?")
+     (flt2       "[0-9]*\\.[0-9]+([Ee][-+]?[0-9]+)?[fFlL]?")
+     (flt3       "[0-9]+\\.[0-9]*([Ee][-+]?[0-9]+)?[fFlL]?"))
+    (|i_constant|
+     (hex        "0[xX][0-9A-Fa-f]+[uUlL]*")
+     (oct        "0[0-7]+[uUlL]*")
+     (dec        "[0-9]+[uUlL]*"))))
+
+(defun compute-token-kind (token)
+  (let ((text  (token-text token)))
+    (or (gethash text *c11-literal-tokens-map*)
+        (let ((kind (first (find-if (lambda (entry)
+                                 (some (lambda (regexp)
+                                         (string-match (format nil "^~A$" (second regexp)) text))
+                                       (rest entry)))
+                                    *c11-regexp-tokens*))))
+          (if (eq kind '|identifier|)
+              (cond
+                ((typedef-name-p              *context* token) '|typedef_name|)
+                ((function-name-p             *context* token) '|func_name|)
+                ((enumeration-constant-name-p *context* token) '|enumeration_constant|)
+                (t kind))
+              kind)))))
+
+;;;; THE END ;;;;
diff --git a/languages/c11/c11-yacc.lisp b/languages/c11/c11-yacc.lisp
new file mode 100644
index 0000000..3825a59
--- /dev/null
+++ b/languages/c11/c11-yacc.lisp
@@ -0,0 +1,541 @@
+(DEFINE-PARSER *C11-PARSER*
+
+  (:START-SYMBOL |translation_unit|)
+
+  (:TERMINALS (
+               |identifier| |typedef_name| |func_name| |string_literal|
+               |i_constant| |f_constant| |enum_name|
+
+               |alignas| |alignof| |atomic| |generic| |noreturn| |static_assert|
+               |thread_local| |case| |default| |if| |else| |switch| |while| |do|
+               |for| |goto| |continue| |break| |return| |struct| |union| |enum|
+               |...| |complex| |imaginary| |bool| |char| |short| |int| |long|
+               |signed| |unsigned| |float| |double| |void| |const| |restrict|
+               |volatile| |typedef| |extern| |static| |auto| |register| |inline|
+               |sizeof|
+
+               ^= \|= -= <<= >>= &= && |\|\|| *= /= %= += -> ++ -- << >>
+               <= >= == !=))
+
+
+  ;; renaming terminals:
+
+  (IDENTIFIER |identifier|)
+  (TYPEDEF_NAME |typedef_name|)
+  (FUNC_NAME |func_name|)
+
+  (STRING_LITERAL |string_literal|)
+  (I_CONSTANT     |i_constant|)
+  (F_CONSTANT     |f_constant|)
+
+  (|constant| I_CONSTANT F_CONSTANT ) ;ENUMERATION_CONSTANT
+  (|string| STRING_LITERAL FUNC_NAME)
+
+
+
+  (ALIGNAS |alignas|)
+  (ALIGNOF |alignof|)
+  (ATOMIC |atomic|)
+  (GENERIC |generic|)
+  (NORETURN |noreturn|)
+  (STATIC_ASSERT |static_assert|)
+  (THREAD_LOCAL |thread_local|)
+  (CASE |case|)
+  (DEFAULT |default|)
+  (IF |if|)
+  (ELSE |else|)
+  (SWITCH |switch|)
+  (WHILE |while|)
+  (DO |do|)
+  (FOR |for|)
+  (GOTO |goto|)
+  (CONTINUE |continue|)
+  (BREAK |break|)
+  (RETURN |return|)
+  (STRUCT |struct|)
+  (UNION |union|)
+  (ENUM |enum|)
+  (ELLIPSIS |...|)
+  (COMPLEX |complex|)
+  (IMAGINARY |imaginary|)
+  (BOOL |bool|)
+  (CHAR |char|)
+  (SHORT |short|)
+  (INT |int|)
+  (LONG |long|)
+  (SIGNED |signed|)
+  (UNSIGNED |unsigned|)
+  (FLOAT |float|)
+  (DOUBLE |double|)
+  (VOID |void|)
+  (CONST |const|)
+  (RESTRICT |restrict|)
+  (VOLATILE |volatile|)
+  (TYPEDEF |typedef|)
+  (EXTERN |extern|)
+  (STATIC |static|)
+  (AUTO |auto|)
+  (REGISTER |register|)
+  (INLINE |inline|)
+  (SIZEOF |sizeof|)
+
+
+  (XOR_ASSIGN  |^=|)
+  (OR_ASSIGN   \|=)
+  (SUB_ASSIGN  |-=|)
+  (LEFT_ASSIGN |<<=|)
+  (RIGHT_ASSIGN |>>=|)
+  (AND_ASSIGN |&=|)
+  (AND_OP |&&|)
+  (OR_OP \|\|)
+  (MUL_ASSIGN |*=|)
+  (DIV_ASSIGN |/=|)
+  (MOD_ASSIGN |%=|)
+  (ADD_ASSIGN |+=|)
+  (PTR_OP |->|)
+  (INC_OP |++|)
+  (DEC_OP |--|)
+  (LEFT_OP |<<|)
+  (RIGHT_OP |>>|)
+  (LE_OP |<=|)
+  (GE_OP |>=|)
+  (EQ_OP |==|)
+  (NE_OP |!=|)
+
+  ;; productions:
+
+  (|primary_expression|
+   IDENTIFIER
+   |constant|
+   |string|
+   (\( |expression| \))
+   |generic_selection|)
+
+  (|generic_selection|
+   (GENERIC \( |assignment_expression| \, |generic_assoc_list| \)))
+
+  (|generic_assoc_list|
+   |generic_association|
+   (|generic_assoc_list| \, |generic_association|))
+
+  (|generic_association|
+   (|type_name| \: |assignment_expression|)
+   (DEFAULT \: |assignment_expression|))
+
+  (|postfix_expression|
+   |primary_expression|
+   (|postfix_expression| [ |expression| ])
+   (|postfix_expression| \( \))
+   (|postfix_expression| \( |argument_expression_list| \))
+   (|postfix_expression| |.| IDENTIFIER)
+   (|postfix_expression| PTR_OP IDENTIFIER)
+   (|postfix_expression| INC_OP)
+   (|postfix_expression| DEC_OP)
+   (\( |type_name| \) { |initializer_list| })
+   (\( |type_name| \) { |initializer_list| \, }))
+
+  (|argument_expression_list|
+   |assignment_expression|
+   (|argument_expression_list| \, |assignment_expression|))
+
+  (|unary_expression|
+   |postfix_expression|
+   (INC_OP |unary_expression|)
+   (DEC_OP |unary_expression|)
+   (|unary_operator| |cast_expression|)
+   (SIZEOF |unary_expression|)
+   (SIZEOF \( |type_name| \))
+   (ALIGNOF \( |type_name| \)))
+
+  (|unary_operator|
+   &
+   *
+   +
+   -
+   ~
+   !)
+
+  (|cast_expression|
+   |unary_expression|
+   (\( |type_name| \) |cast_expression|))
+
+  (|multiplicative_expression|
+   |cast_expression|
+   (|multiplicative_expression| * |cast_expression|)
+   (|multiplicative_expression| / |cast_expression|)
+   (|multiplicative_expression| % |cast_expression|))
+
+  (|additive_expression|
+   |multiplicative_expression|
+   (|additive_expression| + |multiplicative_expression|)
+   (|additive_expression| - |multiplicative_expression|))
+
+  (|shift_expression|
+   |additive_expression|
+   (|shift_expression| LEFT_OP |additive_expression|)
+   (|shift_expression| RIGHT_OP |additive_expression|))
+
+  (|relational_expression|
+   |shift_expression|
+   (|relational_expression| < |shift_expression|)
+   (|relational_expression| > |shift_expression|)
+   (|relational_expression| LE_OP |shift_expression|)
+   (|relational_expression| GE_OP |shift_expression|))
+
+  (|equality_expression|
+   |relational_expression|
+   (|equality_expression| EQ_OP |relational_expression|)
+   (|equality_expression| NE_OP |relational_expression|))
+
+  (|and_expression|
+   |equality_expression|
+   (|and_expression| & |equality_expression|))
+
+  (|exclusive_or_expression|
+   |and_expression|
+   (|exclusive_or_expression| ^ |and_expression|))
+
+  (|inclusive_or_expression|
+   |exclusive_or_expression|
+   (|inclusive_or_expression| \| |exclusive_or_expression|))
+
+  (|logical_and_expression|
+   |inclusive_or_expression|
+   (|logical_and_expression| AND_OP |inclusive_or_expression|))
+
+  (|logical_or_expression|
+   |logical_and_expression|
+   (|logical_or_expression| OR_OP |logical_and_expression|))
+
+  (|conditional_expression|
+   |logical_or_expression|
+   (|logical_or_expression| ? |expression| \: |conditional_expression|))
+
+  (|assignment_expression|
+   |conditional_expression|
+   (|unary_expression| |assignment_operator| |assignment_expression|))
+
+  (|assignment_operator|
+   =
+   MUL_ASSIGN
+   DIV_ASSIGN
+   MOD_ASSIGN
+   ADD_ASSIGN
+   SUB_ASSIGN
+   LEFT_ASSIGN
+   RIGHT_ASSIGN
+   AND_ASSIGN
+   XOR_ASSIGN
+   OR_ASSIGN)
+
+  (|expression|
+   |assignment_expression|
+   (|expression| \, |assignment_expression|))
+
+  (|constant_expression|
+   |conditional_expression|)
+
+  (|declaration|
+   (|declaration_specifiers| \;)
+   (|declaration_specifiers| |init_declarator_list| \;)
+   |static_assert_declaration|)
+
+  (|declaration_specifiers|
+   (|storage_class_specifier| |declaration_specifiers|)
+   |storage_class_specifier|
+   (|type_specifier| |declaration_specifiers|)
+   |type_specifier|
+   (|type_qualifier| |declaration_specifiers|)
+   |type_qualifier|
+   (|function_specifier| |declaration_specifiers|)
+   |function_specifier|
+   (|alignment_specifier| |declaration_specifiers|)
+   |alignment_specifier|)
+
+  (|init_declarator_list|
+   |init_declarator|
+   (|init_declarator_list| \, |init_declarator|))
+
+  (|init_declarator|
+   (|declarator| = |initializer|)
+   |declarator|)
+
+  (|storage_class_specifier|
+   TYPEDEF
+   EXTERN
+   STATIC
+   THREAD_LOCAL
+   AUTO
+   REGISTER)
+
+  (|type_specifier|
+   VOID
+   CHAR
+   SHORT
+   INT
+   LONG
+   FLOAT
+   DOUBLE
+   SIGNED
+   UNSIGNED
+   BOOL
+   COMPLEX
+   IMAGINARY
+   |atomic_type_specifier|
+   |struct_or_union_specifier|
+   |enum_specifier|
+   TYPEDEF_NAME)
+
+  (|struct_or_union_specifier|
+   (|struct_or_union| { |struct_declaration_list| })
+   (|struct_or_union| IDENTIFIER { |struct_declaration_list| })
+   (|struct_or_union| IDENTIFIER))
+
+  (|struct_or_union|
+   STRUCT
+   UNION)
+
+  (|struct_declaration_list|
+   |struct_declaration|
+   (|struct_declaration_list| |struct_declaration|))
+
+  (|struct_declaration|
+   (|specifier_qualifier_list| \;)
+   (|specifier_qualifier_list| |struct_declarator_list| \;)
+   |static_assert_declaration|)
+
+  (|specifier_qualifier_list|
+   (|type_specifier| |specifier_qualifier_list|)
+   |type_specifier|
+   (|type_qualifier| |specifier_qualifier_list|)
+   |type_qualifier|)
+
+  (|struct_declarator_list|
+   |struct_declarator|
+   (|struct_declarator_list| \, |struct_declarator|))
+
+  (|struct_declarator|
+   (\: |constant_expression|)
+   (|declarator| \: |constant_expression|)
+   |declarator|)
+
+  (|enum_specifier|
+   (ENUM { |enumerator_list| })
+   (ENUM { |enumerator_list| \, })
+   (ENUM IDENTIFIER { |enumerator_list| })
+   (ENUM IDENTIFIER { |enumerator_list| \, })
+   (ENUM IDENTIFIER))
+
+  (|enumerator_list|
+   |enumerator|
+   (|enumerator_list| \, |enumerator|))
+
+  (|enumeration_constant|
+   IDENTIFIER)
+
+  (|enumerator|
+   (|enumeration_constant| = |constant_expression|)
+   |enumeration_constant|)
+
+    (|declarator|
+   (|pointer| |direct_declarator|)
+   |direct_declarator|)
+
+  (|direct_declarator|
+   IDENTIFIER
+   (\( |declarator| \))
+   (|direct_declarator| [ ])
+   (|direct_declarator| [ * ])
+   (|direct_declarator| [ STATIC |type_qualifier_list| |assignment_expression| ])
+   (|direct_declarator| [ STATIC |assignment_expression| ])
+   (|direct_declarator| [ |type_qualifier_list| * ])
+   (|direct_declarator| [ |type_qualifier_list| STATIC |assignment_expression| ])
+   (|direct_declarator| [ |type_qualifier_list| |assignment_expression| ])
+   (|direct_declarator| [ |type_qualifier_list| ])
+   (|direct_declarator| [ |assignment_expression| ])
+   (|direct_declarator| \( |parameter_type_list| \))
+   (|direct_declarator| \( \))
+   (|direct_declarator| \( |identifier_list| \)))
+
+  (|pointer|
+   (* |type_qualifier_list| |pointer|)
+   (* |type_qualifier_list|)
+   (* |pointer|)
+   *)
+
+  (|type_qualifier_list|
+   |type_qualifier|
+   (|type_qualifier_list| |type_qualifier|))
+
+  (|parameter_type_list|
+   (|parameter_list| \, ELLIPSIS)
+   |parameter_list|)
+
+  (|parameter_list|
+   |parameter_declaration|
+   (|parameter_list| \, |parameter_declaration|))
+
+  (|parameter_declaration|
+   (|declaration_specifiers| |declarator|)
+   (|declaration_specifiers| |abstract_declarator|)
+   |declaration_specifiers|)
+
+  (|identifier_list|
+   IDENTIFIER
+   (|identifier_list| \, IDENTIFIER))
+
+  (|type_name|
+   (|specifier_qualifier_list| |abstract_declarator|)
+   |specifier_qualifier_list|)
+
+  (|abstract_declarator|
+   (|pointer| |direct_abstract_declarator|)
+   |pointer|
+   |direct_abstract_declarator|)
+
+  (|direct_abstract_declarator|
+   (\( |abstract_declarator| \))
+   ([ ])
+   ([ * ])
+   ([ STATIC |type_qualifier_list| |assignment_expression| ])
+   ([ STATIC |assignment_expression| ])
+   ([ |type_qualifier_list| STATIC |assignment_expression| ])
+   ([ |type_qualifier_list| |assignment_expression| ])
+   ([ |type_qualifier_list| ])
+   ([ |assignment_expression| ])
+   (|direct_abstract_declarator| [ ])
+   (|direct_abstract_declarator| [ * ])
+   (|direct_abstract_declarator| [ STATIC |type_qualifier_list| |assignment_expression| ])
+   (|direct_abstract_declarator| [ STATIC |assignment_expression| ])
+   (|direct_abstract_declarator| [ |type_qualifier_list| |assignment_expression| ])
+   (|direct_abstract_declarator| [ |type_qualifier_list| STATIC |assignment_expression| ])
+   (|direct_abstract_declarator| [ |type_qualifier_list| ])
+   (|direct_abstract_declarator| [ |assignment_expression| ])
+   (\( \))
+   (\( |parameter_type_list| \))
+   (|direct_abstract_declarator| \( \))
+   (|direct_abstract_declarator| \( |parameter_type_list| \)))
+
+  (|initializer|
+   ({ |initializer_list| })
+   ({ |initializer_list| \, })
+   |assignment_expression|)
+
+  (|initializer_list|
+   (|designation| |initializer|)
+   |initializer|
+   (|initializer_list| \, |designation| |initializer|)
+   (|initializer_list| \, |initializer|))
+
+  (|designation|
+   (|designator_list| =))
+
+  (|designator_list|
+   |designator|
+   (|designator_list| |designator|))
+
+  (|designator|
+   ([ |constant_expression| ])
+   (|.| IDENTIFIER))
+
+  (|static_assert_declaration|
+   (STATIC_ASSERT \( |constant_expression| \, STRING_LITERAL \) \;))
+
+  (|statement|
+   |labeled_statement|
+   |compound_statement|
+   |expression_statement|
+   |selection_statement|
+   |iteration_statement|
+   |jump_statement|)
+
+  (|labeled_statement|
+   (IDENTIFIER \: |statement|)
+   (CASE |constant_expression| \: |statement|)
+   (DEFAULT \: |statement|))
+
+  (|compound_statement|
+   ({ })
+   ({ |block_item_list| }))
+
+  (|block_item_list|
+   |block_item|
+   (|block_item_list| |block_item|))
+
+  (|block_item|
+   |declaration|
+   |statement|)
+
+  (|expression_statement|
+   \;
+   (|expression| \;))
+
+  (|selection_statement|
+   (IF \( |expression| \) |statement| ELSE |statement|)
+   (IF \( |expression| \) |statement|)
+   (SWITCH \( |expression| \) |statement|))
+
+  (|iteration_statement|
+   (WHILE \( |expression| \) |statement|)
+   (DO |statement| WHILE \( |expression| \) \;)
+   (FOR \( |expression_statement| |expression_statement|              \) |statement|)
+   (FOR \( |expression_statement| |expression_statement| |expression| \) |statement|)
+   (FOR \( |declaration| |expression_statement|              \) |statement|)
+   (FOR \( |declaration| |expression_statement| |expression| \) |statement|))
+
+  (|jump_statement|
+   (GOTO IDENTIFIER \;)
+   (CONTINUE \;)
+   (BREAK \;)
+   (RETURN \;)
+   (RETURN |expression| \;))
+
+  (|translation_unit|
+   |external_declaration|
+   (|translation_unit| |external_declaration|))
+
+  (|external_declaration|
+   |function_definition|
+   |declaration|)
+
+  (|function_definition|
+   (|declaration_specifiers| |declarator| |declaration_list| |compound_statement|)
+   (|declaration_specifiers| |declarator|                    |compound_statement|))
+
+  (|declaration_list|
+   |declaration|
+   (|declaration_list| |declaration|))
+
+
+  )
+
+
+#-(and)
+(let ((*PRINT-PRETTY*   nil)
+      (*PRINT-LEVEL*   nil)
+      (*PRINT-LENGTH*   nil)
+      (*PRINT-CIRCLE*   nil)
+      (*PRINT-CASE*   :upcase)
+      (*PRINT-READABLY*)
+      (*PRINT-GENSYM*   T)
+      (*PRINT-BASE*   10 )
+      (*PRINT-RADIX*   nil)
+      (*PRINT-ARRAY*   T)
+      (*PRINT-LINES*   nil)
+      (*PRINT-ESCAPE*   T)
+      (*PRINT-RIGHT-MARGIN*   110))
+ (pprint
+  (mapcar (lambda (prod)
+            `(--> ,(first prod)
+                  ,(case (length (rest prod))
+                     ((0) '(seq))
+                     ((1) (if (listp (second prod))
+                              `(seq ,@(second prod))
+                              (second prod)))
+                     (otherwise
+                      `(alt ,@(mapcar (lambda (rhs)
+                                        (if (listp rhs)
+                                            `(seq ,@rhs)
+                                            rhs))
+                                      (rest prod)))))))
+          '())))
diff --git a/languages/c11/com.informatimago.languages.c11.asd b/languages/c11/com.informatimago.languages.c11.asd
index 0c1372c..954eb72 100644
--- a/languages/c11/com.informatimago.languages.c11.asd
+++ b/languages/c11/com.informatimago.languages.c11.asd
@@ -56,13 +56,13 @@
                "yacc")
   :components ((:file "packages"        :depends-on  ())
                (:file "context"         :depends-on  ("packages"))
-               (:file "scanner"         :depends-on  ("packages" "context"))
+               (:file "c11-scanner"     :depends-on  ("packages" "context"))
                (:file "read-yacc"       :depends-on  ("packages"))
                (:file "actions"         :depends-on  ("packages"))
-               (:file "parser"          :depends-on  ("packages"
+               (:file "c11-parser"      :depends-on  ("packages"
                                                       "read-yacc"
                                                       "context"
-                                                      "scanner"
+                                                      "c11-scanner"
                                                       "actions")))
   #+adsf3 :in-order-to #+adsf3 ((asdf:test-op (asdf:test-op "com.informatimago.languages.c11.test"))))

diff --git a/languages/c11/context.lisp b/languages/c11/context.lisp
index c0880a5..014c4c7 100644
--- a/languages/c11/context.lisp
+++ b/languages/c11/context.lisp
@@ -32,8 +32,6 @@
 ;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ;;;;**************************************************************************
 (in-package "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER")
-(eval-when (:compile-toplevel :load-toplevel :execute)
-  (setf *readtable* (copy-readtable nil)))

 (defclass context ()
   ((c-identifiers-package :initarg :c-identifiers-package
@@ -99,6 +97,6 @@ The scanner uses it to detect enumeration_constant tokens."

 (defgeneric enter-enumeration-constant (context name &optional definition)
   (:method ((context context) name &optional (definition t))
-    (enter-into-table context (context-enumeration-constants context) '|enumeration_constant| name definition)))
+    (enter-into-table context (context-enumeration-constants context) '|enum_name| name definition)))

 ;;;; THE END ;;;;
diff --git a/languages/c11/packages.lisp b/languages/c11/packages.lisp
index 72e0ca0..463d9c0 100644
--- a/languages/c11/packages.lisp
+++ b/languages/c11/packages.lisp
@@ -32,19 +32,74 @@
 ;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ;;;;**************************************************************************

-(defpackage "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER"
+(defpackage "COM.INFORMATIMAGO.LANGUAGES.C11.TOKENS"
+  (:use)
+  (:import-from "COMMON-LISP"
+                "*" ">=" "/" "-" "++" "+" ">" "=" "<" "<=" "/=")
+  (:export "identifier" "typedef_name" "func_name" "string_literal"
+           "i_constant" "f_constant" "enum_name" "alignas" "alignof"
+           "atomic" "generic" "noreturn" "static_assert"
+           "thread_local" "case" "default" "if" "else" "switch"
+           "while" "do" "for" "goto" "continue" "break" "return"
+           "struct" "union" "enum" "..." "complex" "imaginary" "bool"
+           "char" "short" "int" "long" "signed" "unsigned" "float"
+           "double" "void" "const" "restrict" "volatile" "typedef"
+           "extern" "static" "auto" "register" "inline" "sizeof" "^="
+           "|=" "-=" "<<=" ">>=" "&=" "&&" "||" "*=" "/=" "%=" "+="
+           "->" "++" "--" "<<" ">>" "<=" ">=" "==" "!=" "(" ")" ","
+           ":" ";" "." "[" "]" "{" "}" "&" "*" "/" "+" "-" "~" "!" "%"
+           "<" ">" "=" "^" "|" "?" "STAR")
+  (:documentation "This package exports the token-kinds of the C11 terminal symbols."))
+
+(defpackage "COM.INFORMATIMAGO.LANGUAGES.C11.SCANNER"
+  (:use "COMMON-LISP"
+        "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.LIST"
+        "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.STREAM"
+        "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.STRING"
+        "COM.INFORMATIMAGO.COMMON-LISP.PARSER.SCANNER"
+        "COM.INFORMATIMAGO.COMMON-LISP.REGEXP.REGEXP"
+        "COM.INFORMATIMAGO.LANGUAGES.C11.TOKENS")
+  (:shadowing-import-from "COM.INFORMATIMAGO.COMMON-LISP.REGEXP.REGEXP"
+                          "SPLIT-STRING")
+  (:export "C11-SCANNER"
+           "COMPUTE-TOKEN-KIND"))
+
+(defpackage "COM.INFORMATIMAGO.LANGUAGES.YACC.PARSER"
   (:use "COMMON-LISP"
         "YACC"
         "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.LIST"
         "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.STREAM"
         "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.STRING"
+        "COM.INFORMATIMAGO.COMMON-LISP.PARSER.SCANNER"
+        "COM.INFORMATIMAGO.COMMON-LISP.REGEXP.REGEXP"
+        "COM.INFORMATIMAGO.LANGUAGES.CPP"
+        "COM.INFORMATIMAGO.TOOLS.READER-MACRO"
+        "COM.INFORMATIMAGO.LANGUAGES.C11.TOKENS")
+  (:shadowing-import-from "COM.INFORMATIMAGO.COMMON-LISP.REGEXP.REGEXP"
+                          "SPLIT-STRING")
+  (:export "C11-SCANNER" "READ-YACC")
+  (:documentation "
+This package exports a function to read yacc grammars,
+returning a yacc:defgrammar form.
+"))
+
+
+(defpackage "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER"
+  (:use "COMMON-LISP"
+        "COM.INFORMATIMAGO.RDP"
+        "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.LIST"
+        "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.STREAM"
+        "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.STRING"
         "COM.INFORMATIMAGO.COMMON-LISP.PARSER.PARSER"
         "COM.INFORMATIMAGO.COMMON-LISP.PARSER.SCANNER"
         "COM.INFORMATIMAGO.COMMON-LISP.REGEXP.REGEXP"
         "COM.INFORMATIMAGO.LANGUAGES.CPP"
-        "COM.INFORMATIMAGO.TOOLS.READER-MACRO")
+        "COM.INFORMATIMAGO.TOOLS.READER-MACRO"
+        "COM.INFORMATIMAGO.LANGUAGES.C11.TOKENS")
   (:shadowing-import-from "COM.INFORMATIMAGO.COMMON-LISP.REGEXP.REGEXP"
-                          "SPLIT-STRING"))
+                          "SPLIT-STRING")
+  (:export "C11-PARSER"))
+

 (defpackage "COM.INFORMATIMAGO.LANGUAGES.C11.C"
   (:use)
diff --git a/languages/c11/parser.lisp b/languages/c11/parser.lisp
deleted file mode 100644
index 4c11b35..0000000
--- a/languages/c11/parser.lisp
+++ /dev/null
@@ -1,559 +0,0 @@
-;;;; -*- mode:lisp;coding:utf-8 -*-
-;;;;**************************************************************************
-;;;;FILE:               parser.lisp
-;;;;LANGUAGE:           Common-Lisp
-;;;;SYSTEM:             Common-Lisp
-;;;;USER-INTERFACE:     NONE
-;;;;DESCRIPTION
-;;;;
-;;;;    C11 parser.
-;;;;
-;;;;AUTHORS
-;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
-;;;;MODIFICATIONS
-;;;;    2015-07-02 <PJB> Created.
-;;;;BUGS
-;;;;LEGAL
-;;;;    AGPL3
-;;;;
-;;;;    Copyright Pascal J. Bourguignon 2015 - 2015
-;;;;
-;;;;    This program is free software: you can redistribute it and/or modify
-;;;;    it under the terms of the GNU Affero General Public License as published by
-;;;;    the Free Software Foundation, either version 3 of the License, or
-;;;;    (at your option) any later version.
-;;;;
-;;;;    This program is distributed in the hope that it will be useful,
-;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;;;    GNU Affero General Public License for more details.
-;;;;
-;;;;    You should have received a copy of the GNU Affero General Public License
-;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-;;;;**************************************************************************
-(in-package "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER")
-(eval-when (:compile-toplevel :load-toplevel :execute)
-  (setf *readtable* (copy-readtable nil)))
-
-#|
-(defmethod accept ((scanner buffered-scanner) token)
-(if (word-equal token (scanner-current-token scanner))
-(prog1 (list (token-kind (scanner-current-token scanner))
-(scanner-current-text scanner)
-(scanner-column scanner))
-(scan-next-token scanner))
-(error 'unexpected-token-error
-:line   (scanner-line   scanner)
-:column (scanner-column scanner)
-:state  (scanner-state  scanner)
-:current-token (scanner-current-token scanner)
-:scanner scanner
-:expected-token token
-:format-control "Expected ~S, not ~A (~S)~%"
-:format-arguments (list
-token
-(scanner-current-token scanner)
-(scanner-current-text scanner)))))
-
-|#
-
-
-(defun make-list-lexer (tokens)
-  (lambda ()
-    (if tokens
-        (let ((token (pop tokens)))
-          (values (setf (token-kind token) (compute-token-kind token))
-                  token))
-        (values nil nil))))
-
-
-
-#-(and) ; not yet.
-(DEFINE-PARSER *C11-PARSER*
-
-  (:START-SYMBOL |translation_unit|)
-
-  (:TERMINALS
-   (
-    |identifier| |typedef_name| |func_name| |string_literal|
-                 |i_constant| |f_constant|
-                 |enumeration_constant|
-
-                 |alignas| |alignof| |atomic| |generic| |noreturn| |static_assert|
-                 |thread_local| |case| |default| |if| |else| |switch| |while| |do|
-                 |for| |goto| |continue| |break| |return| |struct| |union| |enum|
-                 |...| |complex| |imaginary| |bool| |char| |short| |int| |long|
-                 |signed| |unsigned| |float| |double| |void| |const| |restrict|
-                 |volatile| |typedef| |extern| |static| |auto| |register| |inline|
-                 |sizeof|
-
-                 ^= \|= -= <<= >>= &= && |\|\|| *= /= %= += -> ++ -- << >>
-                 <= >= == !=))
-
-
-  ;; renaming terminals:
-
-  (IDENTIFIER |identifier|)
-  (TYPEDEF_NAME |typedef_name|)
-  (FUNC_NAME |func_name|)
-  (ENUMERATION_CONSTANT |enumeration_constant|)
-
-  (STRING_LITERAL |string_literal|)
-  (I_CONSTANT     |i_constant|)
-  (F_CONSTANT     |f_constant|)
-
-  (|constant| I_CONSTANT F_CONSTANT ENUMERATION_CONSTANT)
-  (|string| STRING_LITERAL FUNC_NAME)
-
-
-
-  (ALIGNAS |alignas|)
-  (ALIGNOF |alignof|)
-  (ATOMIC |atomic|)
-  (GENERIC |generic|)
-  (NORETURN |noreturn|)
-  (STATIC_ASSERT |static_assert|)
-  (THREAD_LOCAL |thread_local|)
-  (CASE |case|)
-  (DEFAULT |default|)
-  (IF |if|)
-  (ELSE |else|)
-  (SWITCH |switch|)
-  (WHILE |while|)
-  (DO |do|)
-  (FOR |for|)
-  (GOTO |goto|)
-  (CONTINUE |continue|)
-  (BREAK |break|)
-  (RETURN |return|)
-  (STRUCT |struct|)
-  (UNION |union|)
-  (ENUM |enum|)
-  (ELLIPSIS |...|)
-  (COMPLEX |complex|)
-  (IMAGINARY |imaginary|)
-  (BOOL |bool|)
-  (CHAR |char|)
-  (SHORT |short|)
-  (INT |int|)
-  (LONG |long|)
-  (SIGNED |signed|)
-  (UNSIGNED |unsigned|)
-  (FLOAT |float|)
-  (DOUBLE |double|)
-  (VOID |void|)
-  (CONST |const|)
-  (RESTRICT |restrict|)
-  (VOLATILE |volatile|)
-  (TYPEDEF |typedef|)
-  (EXTERN |extern|)
-  (STATIC |static|)
-  (AUTO |auto|)
-  (REGISTER |register|)
-  (INLINE |inline|)
-  (SIZEOF |sizeof|)
-
-
-  (XOR_ASSIGN  |^=|)
-  (OR_ASSIGN   \|=)
-  (SUB_ASSIGN  |-=|)
-  (LEFT_ASSIGN |<<=|)
-  (RIGHT_ASSIGN |>>=|)
-  (AND_ASSIGN |&=|)
-  (AND_OP |&&|)
-  (OR_OP \|\|)
-  (MUL_ASSIGN |*=|)
-  (DIV_ASSIGN |/=|)
-  (MOD_ASSIGN |%=|)
-  (ADD_ASSIGN |+=|)
-  (PTR_OP |->|)
-  (INC_OP |++|)
-  (DEC_OP |--|)
-  (LEFT_OP |<<|)
-  (RIGHT_OP |>>|)
-  (LE_OP |<=|)
-  (GE_OP |>=|)
-  (EQ_OP |==|)
-  (NE_OP |!=|)
-
-  ;; productions:
-
-  (|primary_expression|
-   IDENTIFIER
-   |constant|
-   |string|
-   (\( |expression| \))
-   |generic_selection|)
-
-  (|generic_selection|
-   (GENERIC \( |assignment_expression| \, |generic_assoc_list| \)))
-
-  (|generic_assoc_list|
-   |generic_association|
-   (|generic_assoc_list| \, |generic_association|))
-
-  (|generic_association|
-   (|type_name| \: |assignment_expression|)
-   (DEFAULT \: |assignment_expression|))
-
-  (|postfix_expression|
-   |primary_expression|
-   (|postfix_expression| \[ |expression| \])
-   (|postfix_expression| \( \))
-   (|postfix_expression| \( |argument_expression_list| \))
-   (|postfix_expression| |.| IDENTIFIER)
-   (|postfix_expression| PTR_OP IDENTIFIER)
-   (|postfix_expression| INC_OP)
-   (|postfix_expression| DEC_OP)
-   (\( |type_name| \) { |initializer_list| })
-   (\( |type_name| \) { |initializer_list| \, }))
-
-  (|argument_expression_list|
-   |assignment_expression|
-   (|argument_expression_list| \, |assignment_expression|))
-
-  (|unary_expression|
-   |postfix_expression|
-   (INC_OP |unary_expression|)
-   (DEC_OP |unary_expression|)
-   (|unary_operator| |cast_expression|)
-   (SIZEOF |unary_expression|)
-   (SIZEOF \( |type_name| \))
-   (ALIGNOF \( |type_name| \)))
-
-  (|unary_operator| & * + - ~ !)
-
-  (|cast_expression|
-   |unary_expression|
-   (\( |type_name| \) |cast_expression|))
-
-  (|multiplicative_expression|
-   |cast_expression|
-   (|multiplicative_expression| * |cast_expression|)
-   (|multiplicative_expression| / |cast_expression|)
-   (|multiplicative_expression| % |cast_expression|))
-
-  (|additive_expression|
-   |multiplicative_expression|
-   (|additive_expression| + |multiplicative_expression|)
-   (|additive_expression| - |multiplicative_expression|))
-
-  (|shift_expression|
-   |additive_expression|
-   (|shift_expression| LEFT_OP |additive_expression|)
-   (|shift_expression| RIGHT_OP |additive_expression|))
-
-  (|relational_expression|
-   |shift_expression|
-   (|relational_expression| < |shift_expression|)
-   (|relational_expression| > |shift_expression|)
-   (|relational_expression| LE_OP |shift_expression|)
-   (|relational_expression| GE_OP |shift_expression|))
-
-  (|equality_expression|
-   |relational_expression|
-   (|equality_expression| EQ_OP |relational_expression|)
-   (|equality_expression| NE_OP |relational_expression|))
-
-  (|and_expression|
-   |equality_expression|
-   (|and_expression| & |equality_expression|))
-
-  (|exclusive_or_expression|
-   |and_expression|
-   (|exclusive_or_expression| ^ |and_expression|))
-
-  (|inclusive_or_expression|
-   |exclusive_or_expression|
-   (|inclusive_or_expression| \| |exclusive_or_expression|))
-
-  (|logical_and_expression|
-   |inclusive_or_expression|
-   (|logical_and_expression| AND_OP |inclusive_or_expression|))
-
-  (|logical_or_expression|
-   |logical_and_expression|
-   (|logical_or_expression| OR_OP |logical_and_expression|))
-
-  (|conditional_expression|
-   |logical_or_expression|
-   (|logical_or_expression| ? |expression| \: |conditional_expression|))
-
-  (|assignment_expression|
-   |conditional_expression|
-   (|unary_expression| |assignment_operator| |assignment_expression|))
-
-  (|assignment_operator| = MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
-                         SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
-                         XOR_ASSIGN OR_ASSIGN)
-
-  (|expression|
-   |assignment_expression|
-   (|expression| \, |assignment_expression|))
-
-  (|constant_expression|
-   |conditional_expression|)
-
-  (|declaration|
-   (|declaration_specifiers| |init_declarator_list| \;  #|#'c-trace|#) ; #'c-declaration
-   (|declaration_specifiers| \;                         #|#'c-trace|#)
-   (|static_assert_declaration|                         #|#'c-trace|#))
-
-  (|declaration_specifier|
-   |storage_class_specifier|
-   |type_specifier|
-   |type_qualifier|
-   |function_specifier|
-   |alignment_specifier|)
-
-  (|declaration_specifiers|
-   (|declaration_specifier|)
-   (|declaration_specifiers| |declaration_specifier|  #|#'c-trace|#))
-
-  (|init_declarator_list|
-   (|init_declarator|)
-   (|init_declarator_list| \, |init_declarator|))
-
-  (|init_declarator|
-   (|declarator| = |initializer| #|#'c-trace|#)
-   (|declarator|                 #|#'c-trace|#))
-
-  (|storage_class_specifier| TYPEDEF EXTERN STATIC THREAD_LOCAL AUTO REGISTER)
-  (|type_specifier| VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED BOOL
-                    COMPLEX IMAGINARY |atomic_type_specifier| |struct_or_union_specifier|
-                    |enum_specifier| TYPEDEF_NAME)
-
-  (|struct_or_union_specifier|
-   (|struct_or_union| { |struct_declaration_list| })
-   (|struct_or_union| IDENTIFIER { |struct_declaration_list| })
-   (|struct_or_union| IDENTIFIER))
-
-  (|struct_or_union| STRUCT UNION)
-
-  (|struct_declaration_list|
-   |struct_declaration|
-   (|struct_declaration_list| |struct_declaration|))
-
-  (|struct_declaration|
-   (|specifier_qualifier_list| \;)
-   (|specifier_qualifier_list| |struct_declarator_list| \;)
-   |static_assert_declaration|)
-
-  (|specifier_qualifier_list|
-   (|type_specifier| |specifier_qualifier_list|)
-   |type_specifier|
-   (|type_qualifier| |specifier_qualifier_list|)
-   |type_qualifier|)
-
-  (|struct_declarator_list|
-   |struct_declarator|
-   (|struct_declarator_list| \, |struct_declarator|))
-
-  (|struct_declarator|
-   (\: |constant_expression|)
-   (|declarator| \: |constant_expression|)
-   |declarator|)
-
-  (|enum_specifier|
-   (ENUM { |enumerator_list| })
-   (ENUM { |enumerator_list| \, })
-   (ENUM IDENTIFIER { |enumerator_list| })
-   (ENUM IDENTIFIER { |enumerator_list| \, })
-   (ENUM IDENTIFIER))
-
-  (|enumerator_list|
-   |enumerator|
-   (|enumerator_list| \, |enumerator|))
-
-  (|enumerator|
-   (|enumeration_constant| = |constant_expression|)
-   |enumeration_constant|)
-
-  (|atomic_type_specifier|
-   (ATOMIC \( |type_name| \)))
-
-  (|type_qualifier| CONST RESTRICT VOLATILE ATOMIC)
-
-  (|function_specifier| INLINE NORETURN)
-
-  (|alignment_specifier|
-   (ALIGNAS \( |type_name| \))
-   (ALIGNAS \( |constant_expression| \)))
-
-  (|declarator|
-   (|pointer| |direct_declarator|    #|#'c-trace|#)
-   (|direct_declarator|              #|#'c-trace|#))
-
-  (|direct_declarator|
-   (IDENTIFIER                       #|#'c-trace|#)
-   (\( |declarator| \))
-   (|direct_declarator| \[ \])
-   (|direct_declarator| \[ * \])
-   (|direct_declarator| \[ STATIC |assignment_expression| \])
-   (|direct_declarator| \[ |type_qualifier_list| * \])
-   (|direct_declarator| \[ |type_qualifier_list| STATIC |assignment_expression| \])
-   (|direct_declarator| \[ |type_qualifier_list| |assignment_expression| \])
-   (|direct_declarator| \[ |type_qualifier_list| \])
-   (|direct_declarator| \[ |assignment_expression| \])
-   (|direct_declarator| \( |parameter_type_list| \))
-   (|direct_declarator| \( \))
-   (|direct_declarator| \( |identifier_list| \)))
-
-  (|pointer|
-   (* |type_qualifier_list| |pointer|)
-   (* |type_qualifier_list|)
-   (* |pointer|)
-   *)
-
-  (|type_qualifier_list|
-   |type_qualifier|
-   (|type_qualifier_list| |type_qualifier|))
-
-  (|parameter_type_list|
-   (|parameter_list| \, ELLIPSIS)
-   |parameter_list|)
-
-  (|parameter_list|
-   |parameter_declaration|
-   (|parameter_list| \, |parameter_declaration|))
-
-  (|parameter_declaration|
-   (|declaration_specifiers| |declarator|)
-   (|declaration_specifiers| |abstract_declarator|)
-   |declaration_specifiers|)
-
-  (|identifier_list|
-   IDENTIFIER
-   (|identifier_list| \, IDENTIFIER))
-
-  (|type_name|
-   (|specifier_qualifier_list| |abstract_declarator|)
-   |specifier_qualifier_list|)
-
-  (|abstract_declarator|
-   (|pointer| |direct_abstract_declarator|)
-   |pointer|
-   |direct_abstract_declarator|)
-
-  (|direct_abstract_declarator|
-   (\( |abstract_declarator| \))
-   (\[ \])
-   (\[ * \])
-   (\[ STATIC |type_qualifier_list| |assignment_expression| \])
-   (\[ STATIC |assignment_expression| \])
-   (\[ |type_qualifier_list| STATIC |assignment_expression| \])
-   (\[ |type_qualifier_list| |assignment_expression| \])
-   (\[ |type_qualifier_list| \])
-   (\[ |assignment_expression| \])
-   (|direct_abstract_declarator| \[ \])
-   (|direct_abstract_declarator| \[ * \])
-   (|direct_abstract_declarator| \[ STATIC |type_qualifier_list| |assignment_expression| \])
-   (|direct_abstract_declarator| \[ STATIC |assignment_expression| \])
-   (|direct_abstract_declarator| \[ |type_qualifier_list| |assignment_expression| \])
-   (|direct_abstract_declarator| \[ |type_qualifier_list| STATIC |assignment_expression| \])
-   (|direct_abstract_declarator| \[ |type_qualifier_list| \])
-   (|direct_abstract_declarator| \[ |assignment_expression| \])
-   (\( \))
-   (\( |parameter_type_list| \))
-   (|direct_abstract_declarator| \( \))
-   (|direct_abstract_declarator| \( |parameter_type_list| \)))
-
-  (|initializer|
-   ({ |initializer_list| })
-   ({ |initializer_list| \, })
-   |assignment_expression|)
-
-  (|initializer_list|
-   (|designation| |initializer|)
-   |initializer|
-   (|initializer_list| \, |designation| |initializer|)
-   (|initializer_list| \, |initializer|))
-
-  (|designation|
-   (|designator_list| =))
-
-  (|designator_list|
-   |designator|
-   (|designator_list| |designator|))
-
-  (|designator|
-   (\[ |constant_expression| \])
-   (|.| IDENTIFIER))
-
-  (|static_assert_declaration|
-   (STATIC_ASSERT \( |constant_expression| \, STRING_LITERAL \) \;))
-
-  (|statement|
-   |labeled_statement|
-   |compound_statement|
-   |expression_statement|
-   |selection_statement|
-   |iteration_statement|
-   |jump_statement|)
-
-  (|labeled_statement|
-   (IDENTIFIER \: |statement|)
-   (CASE |constant_expression| \: |statement|)
-   (DEFAULT \: |statement|))
-
-  (|compound_statement|
-   ({ })
-   ({ |block_item_list| }))
-
-  (|block_item_list|
-   |block_item|
-   (|block_item_list| |block_item|))
-
-  (|block_item|
-   |declaration|
-   |statement|)
-
-  (|expression_statement|
-   \;
-   (|expression| \;))
-
-  (|selection_statement|
-   (IF \( |expression| \) |statement| ELSE |statement|)
-   (IF \( |expression| \) |statement|)
-   (SWITCH \( |expression| \) |statement|))
-
-  (|iteration_statement|
-   (WHILE \( |expression| \) |statement|)
-   (DO |statement| WHILE  \( |expression| \) \;)
-   (FOR \( |expression_statement| |expression_statement| \) |statement|)
-   (FOR \( |expression_statement| |expression_statement| |expression| \) |statement|)
-   (FOR \( |declaration| |expression_statement| \) |statement|)
-   (FOR \( |declaration| |expression_statement| |expression| \) |statement|))
-
-  (|jump_statement|
-   (GOTO IDENTIFIER \;)
-   (CONTINUE \;)
-   (BREAK \;)
-   (RETURN \;)
-   (RETURN |expression| \;))
-
-  (|translation_unit|
-   |external_declaration|
-   (|translation_unit| |external_declaration|))
-
-  (|external_declaration|
-   |function_definition|
-   |declaration|)
-
-  (|function_definition|
-   (|declaration_specifiers| |declarator| |declaration_list| |compound_statement|)
-   (|declaration_specifiers| |declarator| |compound_statement|))
-
-  (|declaration_list|
-   |declaration|
-   (|declaration_list| |declaration|)))
-
-
-
-#-(and)
-(let ((*context* (make-instance 'context)))
-  (values (parse-with-lexer (make-list-lexer *tc*) *c11-parser*)
-          *context*))
-
-
-;;;; THE END ;;;;
diff --git a/languages/c11/parser.yacc b/languages/c11/parser.yacc
deleted file mode 100644
index bb3ac7a..0000000
--- a/languages/c11/parser.yacc
+++ /dev/null
@@ -1,544 +0,0 @@
-/*  Note: There are two shift/reduce conflicts, correctly resolved by default: */
-/*                                                                             */
-/*   IF '(' expression ')' statement _ ELSE statement                          */
-/*                                                                             */
-/* and                                                                         */
-/*                                                                             */
-/*   ATOMIC _ '(' type_name ')'                                                */
-/*                                                                             */
-/* where "_" has been used to flag the points of ambiguity.                    */
-
-%token	IDENTIFIER I_CONSTANT F_CONSTANT STRING_LITERAL FUNC_NAME SIZEOF
-%token	PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
-%token	AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
-%token	SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
-%token	XOR_ASSIGN OR_ASSIGN
-%token	TYPEDEF_NAME ENUMERATION_CONSTANT
-
-%token	TYPEDEF EXTERN STATIC AUTO REGISTER INLINE
-%token	CONST RESTRICT VOLATILE
-%token	BOOL CHAR SHORT INT LONG SIGNED UNSIGNED FLOAT DOUBLE VOID
-%token	COMPLEX IMAGINARY
-%token	STRUCT UNION ENUM ELLIPSIS
-
-%token	CASE DEFAULT IF ELSE SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
-
-%token	ALIGNAS ALIGNOF ATOMIC GENERIC NORETURN STATIC_ASSERT THREAD_LOCAL
-
-%start translation_unit
-%%
-
-primary_expression
-	: IDENTIFIER
-	| constant
-	| string
-	| '(' expression ')'
-	| generic_selection
-	;
-
-constant
-	: I_CONSTANT		/* includes character_constant */
-	| F_CONSTANT
-	| ENUMERATION_CONSTANT	/* after it has been defined as such */
-	;
-
-enumeration_constant		/* before it has been defined as such */
-	: IDENTIFIER
-	;
-
-string
-	: STRING_LITERAL
-	| FUNC_NAME
-	;
-
-generic_selection
-	: GENERIC '(' assignment_expression ',' generic_assoc_list ')'
-	;
-
-generic_assoc_list
-	: generic_association
-	| generic_assoc_list ',' generic_association
-	;
-
-generic_association
-	: type_name ':' assignment_expression
-	| DEFAULT ':' assignment_expression
-	;
-
-postfix_expression
-	: primary_expression
-	| postfix_expression '[' expression ']'
-	| postfix_expression '(' ')'
-	| postfix_expression '(' argument_expression_list ')'
-	| postfix_expression '.' IDENTIFIER
-	| postfix_expression PTR_OP IDENTIFIER
-	| postfix_expression INC_OP
-	| postfix_expression DEC_OP
-	| '(' type_name ')' '{' initializer_list '}'
-	| '(' type_name ')' '{' initializer_list ',' '}'
-	;
-
-argument_expression_list
-	: assignment_expression
-	| argument_expression_list ',' assignment_expression
-	;
-
-unary_expression
-	: postfix_expression
-	| INC_OP unary_expression
-	| DEC_OP unary_expression
-	| unary_operator cast_expression
-	| SIZEOF unary_expression
-	| SIZEOF '(' type_name ')'
-	| ALIGNOF '(' type_name ')'
-	;
-
-unary_operator
-	: '&'
-	| '*'
-	| '+'
-	| '-'
-	| '~'
-	| '!'
-	;
-
-cast_expression
-	: unary_expression
-	| '(' type_name ')' cast_expression
-	;
-
-multiplicative_expression
-	: cast_expression
-	| multiplicative_expression '*' cast_expression
-	| multiplicative_expression '/' cast_expression
-	| multiplicative_expression '%' cast_expression
-	;
-
-additive_expression
-	: multiplicative_expression
-	| additive_expression '+' multiplicative_expression
-	| additive_expression '-' multiplicative_expression
-	;
-
-shift_expression
-	: additive_expression
-	| shift_expression LEFT_OP additive_expression
-	| shift_expression RIGHT_OP additive_expression
-	;
-
-relational_expression
-	: shift_expression
-	| relational_expression '<' shift_expression
-	| relational_expression '>' shift_expression
-	| relational_expression LE_OP shift_expression
-	| relational_expression GE_OP shift_expression
-	;
-
-equality_expression
-	: relational_expression
-	| equality_expression EQ_OP relational_expression
-	| equality_expression NE_OP relational_expression
-	;
-
-and_expression
-	: equality_expression
-	| and_expression '&' equality_expression
-	;
-
-exclusive_or_expression
-	: and_expression
-	| exclusive_or_expression '^' and_expression
-	;
-
-inclusive_or_expression
-	: exclusive_or_expression
-	| inclusive_or_expression '|' exclusive_or_expression
-	;
-
-logical_and_expression
-	: inclusive_or_expression
-	| logical_and_expression AND_OP inclusive_or_expression
-	;
-
-logical_or_expression
-	: logical_and_expression
-	| logical_or_expression OR_OP logical_and_expression
-	;
-
-conditional_expression
-	: logical_or_expression
-	| logical_or_expression '?' expression ':' conditional_expression
-	;
-
-assignment_expression
-	: conditional_expression
-	| unary_expression assignment_operator assignment_expression
-	;
-
-assignment_operator
-	: '='
-	| MUL_ASSIGN
-	| DIV_ASSIGN
-	| MOD_ASSIGN
-	| ADD_ASSIGN
-	| SUB_ASSIGN
-	| LEFT_ASSIGN
-	| RIGHT_ASSIGN
-	| AND_ASSIGN
-	| XOR_ASSIGN
-	| OR_ASSIGN
-	;
-
-expression
-	: assignment_expression
-	| expression ',' assignment_expression
-	;
-
-constant_expression
-	: conditional_expression	/* with constraints */
-	;
-
-declaration
-	: declaration_specifiers ';'
-	| declaration_specifiers init_declarator_list ';'
-	| static_assert_declaration
-	;
-
-declaration_specifiers
-	: storage_class_specifier declaration_specifiers
-	| storage_class_specifier
-	| type_specifier declaration_specifiers
-	| type_specifier
-	| type_qualifier declaration_specifiers
-	| type_qualifier
-	| function_specifier declaration_specifiers
-	| function_specifier
-	| alignment_specifier declaration_specifiers
-	| alignment_specifier
-	;
-
-init_declarator_list
-	: init_declarator
-	| init_declarator_list ',' init_declarator
-	;
-
-init_declarator
-	: declarator '=' initializer
-	| declarator
-	;
-
-storage_class_specifier
-	: TYPEDEF	/* identifiers must be flagged as TYPEDEF_NAME */
-	| EXTERN
-	| STATIC
-	| THREAD_LOCAL
-	| AUTO
-	| REGISTER
-	;
-
-type_specifier
-	: VOID
-	| CHAR
-	| SHORT
-	| INT
-	| LONG
-	| FLOAT
-	| DOUBLE
-	| SIGNED
-	| UNSIGNED
-	| BOOL
-	| COMPLEX
-	| IMAGINARY	  	/* non-mandated extension */
-	| atomic_type_specifier
-	| struct_or_union_specifier
-	| enum_specifier
-	| TYPEDEF_NAME		/* after it has been defined as such */
-	;
-
-struct_or_union_specifier
-	: struct_or_union '{' struct_declaration_list '}'
-	| struct_or_union IDENTIFIER '{' struct_declaration_list '}'
-	| struct_or_union IDENTIFIER
-	;
-
-struct_or_union
-	: STRUCT
-	| UNION
-	;
-
-struct_declaration_list
-	: struct_declaration
-	| struct_declaration_list struct_declaration
-	;
-
-struct_declaration
-	: specifier_qualifier_list ';'	/* for anonymous struct/union */
-	| specifier_qualifier_list struct_declarator_list ';'
-	| static_assert_declaration
-	;
-
-specifier_qualifier_list
-	: type_specifier specifier_qualifier_list
-	| type_specifier
-	| type_qualifier specifier_qualifier_list
-	| type_qualifier
-	;
-
-struct_declarator_list
-	: struct_declarator
-	| struct_declarator_list ',' struct_declarator
-	;
-
-struct_declarator
-	: ':' constant_expression
-	| declarator ':' constant_expression
-	| declarator
-	;
-
-enum_specifier
-	: ENUM '{' enumerator_list '}'
-	| ENUM '{' enumerator_list ',' '}'
-	| ENUM IDENTIFIER '{' enumerator_list '}'
-	| ENUM IDENTIFIER '{' enumerator_list ',' '}'
-	| ENUM IDENTIFIER
-	;
-
-enumerator_list
-	: enumerator
-	| enumerator_list ',' enumerator
-	;
-
-enumerator	/* identifiers must be flagged as ENUMERATION_CONSTANT */
-	: enumeration_constant '=' constant_expression
-	| enumeration_constant
-	;
-
-atomic_type_specifier
-	: ATOMIC '(' type_name ')'
-	;
-
-type_qualifier
-	: CONST
-	| RESTRICT
-	| VOLATILE
-	| ATOMIC
-	;
-
-function_specifier
-	: INLINE
-	| NORETURN
-	;
-
-alignment_specifier
-	: ALIGNAS '(' type_name ')'
-	| ALIGNAS '(' constant_expression ')'
-	;
-
-declarator
-	: pointer direct_declarator
-	| direct_declarator
-	;
-
-direct_declarator
-	: IDENTIFIER
-	| '(' declarator ')'
-	| direct_declarator '[' ']'
-	| direct_declarator '[' '*' ']'
-	| direct_declarator '[' STATIC type_qualifier_list assignment_expression ']'
-	| direct_declarator '[' STATIC assignment_expression ']'
-	| direct_declarator '[' type_qualifier_list '*' ']'
-	| direct_declarator '[' type_qualifier_list STATIC assignment_expression ']'
-	| direct_declarator '[' type_qualifier_list assignment_expression ']'
-	| direct_declarator '[' type_qualifier_list ']'
-	| direct_declarator '[' assignment_expression ']'
-	| direct_declarator '(' parameter_type_list ')'
-	| direct_declarator '(' ')'
-	| direct_declarator '(' identifier_list ')'
-	;
-
-pointer
-	: '*' type_qualifier_list pointer
-	| '*' type_qualifier_list
-	| '*' pointer
-	| '*'
-	;
-
-type_qualifier_list
-	: type_qualifier
-	| type_qualifier_list type_qualifier
-	;
-
-
-parameter_type_list
-	: parameter_list ',' ELLIPSIS
-	| parameter_list
-	;
-
-parameter_list
-	: parameter_declaration
-	| parameter_list ',' parameter_declaration
-	;
-
-parameter_declaration
-	: declaration_specifiers declarator
-	| declaration_specifiers abstract_declarator
-	| declaration_specifiers
-	;
-
-identifier_list
-	: IDENTIFIER
-	| identifier_list ',' IDENTIFIER
-	;
-
-type_name
-	: specifier_qualifier_list abstract_declarator
-	| specifier_qualifier_list
-	;
-
-abstract_declarator
-	: pointer direct_abstract_declarator
-	| pointer
-	| direct_abstract_declarator
-	;
-
-direct_abstract_declarator
-	: '(' abstract_declarator ')'
-	| '[' ']'
-	| '[' '*' ']'
-	| '[' STATIC type_qualifier_list assignment_expression ']'
-	| '[' STATIC assignment_expression ']'
-	| '[' type_qualifier_list STATIC assignment_expression ']'
-	| '[' type_qualifier_list assignment_expression ']'
-	| '[' type_qualifier_list ']'
-	| '[' assignment_expression ']'
-	| direct_abstract_declarator '[' ']'
-	| direct_abstract_declarator '[' '*' ']'
-	| direct_abstract_declarator '[' STATIC type_qualifier_list assignment_expression ']'
-	| direct_abstract_declarator '[' STATIC assignment_expression ']'
-	| direct_abstract_declarator '[' type_qualifier_list assignment_expression ']'
-	| direct_abstract_declarator '[' type_qualifier_list STATIC assignment_expression ']'
-	| direct_abstract_declarator '[' type_qualifier_list ']'
-	| direct_abstract_declarator '[' assignment_expression ']'
-	| '(' ')'
-	| '(' parameter_type_list ')'
-	| direct_abstract_declarator '(' ')'
-	| direct_abstract_declarator '(' parameter_type_list ')'
-	;
-
-initializer
-	: '{' initializer_list '}'
-	| '{' initializer_list ',' '}'
-	| assignment_expression
-	;
-
-initializer_list
-	: designation initializer
-	| initializer
-	| initializer_list ',' designation initializer
-	| initializer_list ',' initializer
-	;
-
-designation
-	: designator_list '='
-	;
-
-designator_list
-	: designator
-	| designator_list designator
-	;
-
-designator
-	: '[' constant_expression ']'
-	| '.' IDENTIFIER
-	;
-
-static_assert_declaration
-	: STATIC_ASSERT '(' constant_expression ',' STRING_LITERAL ')' ';'
-	;
-
-statement
-	: labeled_statement
-	| compound_statement
-	| expression_statement
-	| selection_statement
-	| iteration_statement
-	| jump_statement
-	;
-
-labeled_statement
-	: IDENTIFIER ':' statement
-	| CASE constant_expression ':' statement
-	| DEFAULT ':' statement
-	;
-
-compound_statement
-	: '{' '}'
-	| '{'  block_item_list '}'
-	;
-
-block_item_list
-	: block_item
-	| block_item_list block_item
-	;
-
-block_item
-	: declaration
-	| statement
-	;
-
-expression_statement
-	: ';'
-	| expression ';'
-	;
-
-selection_statement
-	: IF '(' expression ')' statement ELSE statement
-	| IF '(' expression ')' statement
-	| SWITCH '(' expression ')' statement
-	;
-
-iteration_statement
-	: WHILE '(' expression ')' statement
-	| DO statement WHILE '(' expression ')' ';'
-	| FOR '(' expression_statement expression_statement ')' statement
-	| FOR '(' expression_statement expression_statement expression ')' statement
-	| FOR '(' declaration expression_statement ')' statement
-	| FOR '(' declaration expression_statement expression ')' statement
-	;
-
-jump_statement
-	: GOTO IDENTIFIER ';'
-	| CONTINUE ';'
-	| BREAK ';'
-	| RETURN ';'
-	| RETURN expression ';'
-	;
-
-translation_unit
-	: external_declaration
-	| translation_unit external_declaration
-	;
-
-external_declaration
-	: function_definition
-	| declaration
-	;
-
-function_definition
-	: declaration_specifiers declarator declaration_list compound_statement
-	| declaration_specifiers declarator compound_statement
-	;
-
-declaration_list
-	: declaration
-	| declaration_list declaration
-	;
-
-%%
-#include <stdio.h>
-
-void yyerror(const char *s)
-{
-	fflush(stdout);
-	fprintf(stderr, "*** %s\n", s);
-}
diff --git a/languages/c11/read-yacc.lisp b/languages/c11/read-yacc.lisp
index af12a09..226803f 100644
--- a/languages/c11/read-yacc.lisp
+++ b/languages/c11/read-yacc.lisp
@@ -31,7 +31,7 @@
 ;;;;    You should have received a copy of the GNU Affero General Public License
 ;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ;;;;**************************************************************************
-(in-package "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER")
+(in-package "COM.INFORMATIMAGO.LANGUAGES.YACC.PARSER")

 (defun remove-comments (text &key (single-line-comments t))
   (flet ((concatenate-chunks (chunks)
@@ -244,10 +244,12 @@
                (:terminals ,(getf header :tokens))
                ,@rules))))

-#-(and) (
+#-(and) (progn

- (with-open-file (stream #P"~/src/public/lisp/languages/c11/parser.yacc")
-   (read-yacc stream))
-         )
+          (in-package "COM.INFORMATIMAGO.LANGUAGES.YACC.PARSER")
+          (with-open-file (stream #P"~/src/public/lisp/languages/c11/c11-parser.yacc")
+            (read-yacc stream "c11"))
+
+          )

 ;;;; THE END ;;;;
diff --git a/languages/c11/scanner.lex b/languages/c11/scanner.lex
deleted file mode 100644
index 0baead6..0000000
--- a/languages/c11/scanner.lex
+++ /dev/null
@@ -1,176 +0,0 @@
-
-D			[0-9]
-L			[a-zA-Z_]
-H			[a-fA-F0-9]
-E			[Ee][+-]?{D}+
-FS			(f|F|l|L)
-IS			(u|U|l|L)*
-
-%{
-#include <stdio.h>
-#include "y.tab.h"
-
-void count();
-%}
-
-%%
-"/*"			{ comment(); }
-
-"auto"			{ count(); return(AUTO); }
-"break"			{ count(); return(BREAK); }
-"case"			{ count(); return(CASE); }
-"char"			{ count(); return(CHAR); }
-"const"			{ count(); return(CONST); }
-"continue"		{ count(); return(CONTINUE); }
-"default"		{ count(); return(DEFAULT); }
-"do"			{ count(); return(DO); }
-"double"		{ count(); return(DOUBLE); }
-"else"			{ count(); return(ELSE); }
-"enum"			{ count(); return(ENUM); }
-"extern"		{ count(); return(EXTERN); }
-"float"			{ count(); return(FLOAT); }
-"for"			{ count(); return(FOR); }
-"goto"			{ count(); return(GOTO); }
-"if"			{ count(); return(IF); }
-"int"			{ count(); return(INT); }
-"long"			{ count(); return(LONG); }
-"register"		{ count(); return(REGISTER); }
-"return"		{ count(); return(RETURN); }
-"short"			{ count(); return(SHORT); }
-"signed"		{ count(); return(SIGNED); }
-"sizeof"		{ count(); return(SIZEOF); }
-"static"		{ count(); return(STATIC); }
-"struct"		{ count(); return(STRUCT); }
-"switch"		{ count(); return(SWITCH); }
-"typedef"		{ count(); return(TYPEDEF); }
-"union"			{ count(); return(UNION); }
-"unsigned"		{ count(); return(UNSIGNED); }
-"void"			{ count(); return(VOID); }
-"volatile"		{ count(); return(VOLATILE); }
-"while"			{ count(); return(WHILE); }
-
-{L}({L}|{D})*		{ count(); return(check_type()); }
-
-0[xX]{H}+{IS}?		{ count(); return(CONSTANT); }
-0{D}+{IS}?		{ count(); return(CONSTANT); }
-{D}+{IS}?		{ count(); return(CONSTANT); }
-L?'(\\.|[^\\'])+'	{ count(); return(CONSTANT); } /* ' */
-
-{D}+{E}{FS}?		{ count(); return(CONSTANT); }
-{D}*"."{D}+({E})?{FS}?	{ count(); return(CONSTANT); }
-{D}+"."{D}*({E})?{FS}?	{ count(); return(CONSTANT); }
-
-L?\"(\\.|[^\\"])*\"	{ count(); return(STRING_LITERAL); } /* " */
-
-"..."			{ count(); return(ELLIPSIS); }
-">>="			{ count(); return(RIGHT_ASSIGN); }
-"<<="			{ count(); return(LEFT_ASSIGN); }
-"+="			{ count(); return(ADD_ASSIGN); }
-"-="			{ count(); return(SUB_ASSIGN); }
-"*="			{ count(); return(MUL_ASSIGN); }
-"/="			{ count(); return(DIV_ASSIGN); }
-"%="			{ count(); return(MOD_ASSIGN); }
-"&="			{ count(); return(AND_ASSIGN); }
-"^="			{ count(); return(XOR_ASSIGN); }
-"|="			{ count(); return(OR_ASSIGN); }
-">>"			{ count(); return(RIGHT_OP); }
-"<<"			{ count(); return(LEFT_OP); }
-"++"			{ count(); return(INC_OP); }
-"--"			{ count(); return(DEC_OP); }
-"->"			{ count(); return(PTR_OP); }
-"&&"			{ count(); return(AND_OP); }
-"||"			{ count(); return(OR_OP); }
-"<="			{ count(); return(LE_OP); }
-">="			{ count(); return(GE_OP); }
-"=="			{ count(); return(EQ_OP); }
-"!="			{ count(); return(NE_OP); }
-";"			{ count(); return(';'); }
-("{"|"<%")		{ count(); return('{'); }
-("}"|"%>")		{ count(); return('}'); }
-","			{ count(); return(','); }
-":"			{ count(); return(':'); }
-"="			{ count(); return('='); }
-"("			{ count(); return('('); }
-")"			{ count(); return(')'); }
-("["|"<:")		{ count(); return('['); }
-("]"|":>")		{ count(); return(']'); }
-"."			{ count(); return('.'); }
-"&"			{ count(); return('&'); }
-"!"			{ count(); return('!'); }
-"~"			{ count(); return('~'); }
-"-"			{ count(); return('-'); }
-"+"			{ count(); return('+'); }
-"*"			{ count(); return('*'); }
-"/"			{ count(); return('/'); }
-"%"			{ count(); return('%'); }
-"<"			{ count(); return('<'); }
-">"			{ count(); return('>'); }
-"^"			{ count(); return('^'); }
-"|"			{ count(); return('|'); }
-"?"			{ count(); return('?'); }
-
-[ \t\v\n\f]		{ count(); }
-.			{ /* ignore bad characters */ }
-
-%%
-
-yywrap()
-{
-	return(1);
-}
-
-
-comment()
-{
-	char c, c1;
-
-loop:
-	while ((c = input()) != '*' && c != 0)
-		putchar(c);
-
-	if ((c1 = input()) != '/' && c != 0)
-	{
-		unput(c1);
-		goto loop;
-	}
-
-	if (c != 0)
-		putchar(c1);
-}
-
-
-int column = 0;
-
-void count()
-{
-	int i;
-
-	for (i = 0; yytext[i] != '\0'; i++)
-		if (yytext[i] == '\n')
-			column = 0;
-		else if (yytext[i] == '\t')
-			column += 8 - (column % 8);
-		else
-			column++;
-
-	ECHO;
-}
-
-
-int check_type()
-{
-/*
-* pseudo code --- this is what it should check
-*
-*	if (yytext == type_name)
-*		return(TYPE_NAME);
-*
-*	return(IDENTIFIER);
-*/
-
-/*
-*	it actually will only return IDENTIFIER
-*/
-
-	return(IDENTIFIER);
-}
diff --git a/languages/c11/scanner.lisp b/languages/c11/scanner.lisp
deleted file mode 100644
index ab93a4a..0000000
--- a/languages/c11/scanner.lisp
+++ /dev/null
@@ -1,126 +0,0 @@
-;;;; -*- mode:lisp;coding:utf-8 -*-
-;;;;**************************************************************************
-;;;;FILE:               scanner.lisp
-;;;;LANGUAGE:           Common-Lisp
-;;;;SYSTEM:             Common-Lisp
-;;;;USER-INTERFACE:     NONE
-;;;;DESCRIPTION
-;;;;
-;;;;    C11 Scanner.
-;;;;
-;;;;AUTHORS
-;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
-;;;;MODIFICATIONS
-;;;;    2015-07-02 <PJB> Created.
-;;;;BUGS
-;;;;LEGAL
-;;;;    AGPL3
-;;;;
-;;;;    Copyright Pascal J. Bourguignon 2015 - 2015
-;;;;
-;;;;    This program is free software: you can redistribute it and/or modify
-;;;;    it under the terms of the GNU Affero General Public License as published by
-;;;;    the Free Software Foundation, either version 3 of the License, or
-;;;;    (at your option) any later version.
-;;;;
-;;;;    This program is distributed in the hope that it will be useful,
-;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;;;    GNU Affero General Public License for more details.
-;;;;
-;;;;    You should have received a copy of the GNU Affero General Public License
-;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-;;;;**************************************************************************
-(in-package "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER")
-(eval-when (:compile-toplevel :load-toplevel :execute)
-  (setf *readtable* (copy-readtable nil)))
-
-#-(and) ; we use the cpp-scanner.
-(define-scanner c11-scanner
-  :terminals  (
-               "!" "!=" "%" "%=" "%>" "&" "&&" "&=" "(" ")"
-               "*" "*=" "+" "++" "+=" "," "-" "--" "-=" "->" "." "..."
-               "/" "/=" ":" ":>" ";" "<" "<%" "<:" "<<" "<<=" "<=" "="
-               "==" ">" ">=" ">>" ">>=" "?" "[" "]" "^" "^=" "_Bool"
-               "_Complex" "_Imaginary" "__asm__" "__builtin_va_list"
-               "__const" "__inline" "__inline__" "__restrict" "asm"
-               "auto" "break" "case" "char" "const" "continue"
-               "default" "do" "double" "else" "enum" "extern" "float"
-               "for" "goto" "if" "inline" "int" "long" "register"
-               "restrict" "return" "short" "signed" "sizeof" "static"
-               "struct" "switch" "typedef" "union" "unsigned" "void"
-               "volatile" "while" "{" "|" "|=" "||" "}" "~" "~="
-               (identifier "[a-zA-Z_$][a-zA-Z_$0-9]*")
-               (hex        "0[xX][0-9A-Fa-f]+[uUlL]*")
-               (oct        "0[0-7]+[uUlL]*")
-               (dec        "[0-9]+[uUlL]*")
-               (lchar      "L?'(\\.|[^\\'])+'")
-               (flt1       "[0-9]+[Ee][-+]?[0-9]+[fFlL]?")
-               (flt2       "[0-9]*\\.[0-9]+([Ee][-+]?[0-9]+)?[fFlL]?")
-               (flt3       "[0-9]+\\.[0-9]*([Ee][-+]?[0-9]+)?[fFlL]?")
-               (str        "L?\"(\\.|[^\\\"])*\""))
-  :alphanumerics "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$"
-  :spaces (load-time-value  (coerce (remove-duplicates
-                                     '(#\Space
-                                       #\Newline
-                                       #+has-tab     #\Tab
-                                       #+has-page    #\Page
-                                       #+has-null    #\Null
-                                       #+(and has-return   (not newline-is-return))   #\Return
-                                       #+(and has-linefeed (not newline-is-linefeed)) #\Linefeed))
-                                    'string)))
-
-
-(defparameter *c11-literal-tokens*
-  '("!" "!=" "%" "%=" "%>" "&" "&&" "&=" "(" ")"
-    "*" "*=" "+" "++" "+=" "," "-" "--" "-=" "->" "." "..."
-    "/" "/=" ":" ":>" ";" "<" "<%" "<:" "<<" "<<=" "<=" "="
-    "==" ">" ">=" ">>" ">>=" "?" "[" "]" "^" "^=" "_Bool"
-    "_Complex" "_Imaginary" "__asm__" "__builtin_va_list"
-    "__const" "__inline" "__inline__" "__restrict" "asm"
-    "auto" "break" "case" "char" "const" "continue"
-    "default" "do" "double" "else" "enum" "extern" "float"
-    "for" "goto" "if" "inline" "int" "long" "register"
-    "restrict" "return" "short" "signed" "sizeof" "static"
-    "struct" "switch" "typedef" "union" "unsigned" "void"
-    "volatile" "while" "{" "|" "|=" "||" "}" "~" "~="))
-
-(defparameter *c11-literal-tokens-map*
-  (let ((table (make-hash-table :test 'equal)))
-    (dolist (token *c11-literal-tokens* table)
-      (setf (gethash token table) (intern token)))))
-
-(defparameter *c11-regexp-tokens*
-  ;; order matters
-  '((|string_literal|
-     (str        "L?\"(\\.|[^\\\"])*\""))
-    (|i_constant|
-     (lchar      "L?'(\\.|[^\\'])+'"))
-    (|identifier|
-     (identifier "[a-zA-Z_$][a-zA-Z_$0-9]*"))
-    (|f_constant|
-     (flt1       "[0-9]+[Ee][-+]?[0-9]+[fFlL]?")
-     (flt2       "[0-9]*\\.[0-9]+([Ee][-+]?[0-9]+)?[fFlL]?")
-     (flt3       "[0-9]+\\.[0-9]*([Ee][-+]?[0-9]+)?[fFlL]?"))
-    (|i_constant|
-     (hex        "0[xX][0-9A-Fa-f]+[uUlL]*")
-     (oct        "0[0-7]+[uUlL]*")
-     (dec        "[0-9]+[uUlL]*"))))
-
-(defun compute-token-kind (token)
-  (let ((text  (token-text token)))
-    (or (gethash text *c11-literal-tokens-map*)
-        (let ((kind (first (find-if (lambda (entry)
-                                 (some (lambda (regexp)
-                                         (string-match (format nil "^~A$" (second regexp)) text))
-                                       (rest entry)))
-                                    *c11-regexp-tokens*))))
-          (if (eq kind '|identifier|)
-              (cond
-                ((typedef-name-p              *context* token) '|typedef_name|)
-                ((function-name-p             *context* token) '|func_name|)
-                ((enumeration-constant-name-p *context* token) '|enumeration_constant|)
-                (t kind))
-              kind)))))
-
-;;;; THE END ;;;;
diff --git a/languages/c11/scratch.lisp b/languages/c11/scratch.lisp
index 5b9c1b6..5e95968 100644
--- a/languages/c11/scratch.lisp
+++ b/languages/c11/scratch.lisp
@@ -1,34 +1,44 @@
 (in-package "COM.INFORMATIMAGO.LANGUAGES.C11.PARSER")
-(eval-when (:compile-toplevel :load-toplevel :execute)
-  (setf *readtable* (copy-readtable nil)))
-

 ;; (untrace compute-token-kind)
 ;; 7 seconds.
 (defparameter *tc*
-  (mapcar (lambda (token)
-            (setf (token-kind token) (compute-token-kind token))
-            token)
-          (reduce (function append)
-                  (reverse (com.informatimago.languages.cpp::context-output-lines
-                            (let ((*identifier-package*
-                                    (load-time-value (find-package "COM.INFORMATIMAGO.LANGUAGES.C11.C"))))
-                              (cpp-e "/Users/pjb/src/public/lisp/languages/cpp/tests/emacs.c"
-                                     :trace-includes t
-                                     :defines '("__GNUC__" "4" "__STDC__" "1" "__x86_64__" "1")
-                                     :includes '("/Users/pjb/src/macosx/emacs-24.5/src/")
-                                     :include-bracket-directories '("/Users/pjb/src/macosx/emacs-24.5/src/"
-                                                                    "/Users/pjb/src/macosx/emacs-24.5/lib/"
-                                                                    "/Users/pjb/src/macosx/gcc-4.9.2/gcc/ginclude/"
-                                                                    "/usr/include/")
-                                     :write-processed-lines nil))))
-                  :initial-value '())))
-
+  (let ((tokens (reduce (function append)
+                        (reverse (com.informatimago.languages.cpp::context-output-lines
+                                  (let ((*identifier-package*
+                                          (load-time-value (find-package "COM.INFORMATIMAGO.LANGUAGES.C11.C"))))
+                                    (cpp-e "/Users/pjb/src/public/lisp/languages/cpp/tests/emacs.c"
+                                           :trace-includes t
+                                           :defines '("__GNUC__" "4" "__STDC__" "1" "__x86_64__" "1")
+                                           :includes '("/Users/pjb/src/macosx/emacs-24.5/src/")
+                                           :include-bracket-directories '("/Users/pjb/src/macosx/emacs-24.5/src/"
+                                                                          "/Users/pjb/src/macosx/emacs-24.5/lib/"
+                                                                          "/Users/pjb/src/macosx/gcc-4.9.2/gcc/ginclude/"
+                                                                          "/usr/include/")
+                                           :write-processed-lines nil))))
+                        :initial-value '())))
+    (dolist (token tokens tokens)
+      (setf (token-kind token) (compute-token-kind token)))))
+
+;; yacc
+
+(defun make-list-lexer (tokens)
+  (lambda ()
+    (if tokens
+        (let ((token (pop tokens)))
+          (values (token-kind token) token))
+        (values nil nil))))

 (let ((*context* (make-instance 'context)))
   (values (parse-with-lexer (make-list-lexer *tc*) *c11-parser*)
           *context*))

+;; rdp:
+(defun test/parse-stream (src)
+  (let ((*scanner* (make-instance '-scanner :source src)))
+   (loop
+     :until (typep (scanner-current-token *scanner*) 'tok-eof)
+     :collect  (lse-parser *scanner*))))


 #-(and) (
diff --git a/languages/linc/com.informatimago.linc.asd b/languages/linc/com.informatimago.linc.asd
deleted file mode 100644
index c449e8d..0000000
--- a/languages/linc/com.informatimago.linc.asd
+++ /dev/null
@@ -1,76 +0,0 @@
-;;;; -*- mode:lisp;coding:utf-8 -*-
-;;;;**************************************************************************
-;;;;FILE:               linc.asd
-;;;;LANGUAGE:           Common-Lisp
-;;;;SYSTEM:             Common-Lisp
-;;;;USER-INTERFACE:     NONE
-;;;;DESCRIPTION
-;;;;
-;;;;    ASD file for the Linc project.
-;;;;
-;;;;AUTHORS
-;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
-;;;;MODIFICATIONS
-;;;;    2012-07-02 <PJB> Created.
-;;;;BUGS
-;;;;LEGAL
-;;;;    AGPL3
-;;;;
-;;;;    Copyright Pascal J. Bourguignon 2012 - 2015
-;;;;
-;;;;    This program is free software: you can redistribute it and/or modify
-;;;;    it under the terms of the GNU Affero General Public License as published by
-;;;;    the Free Software Foundation, either version 3 of the License, or
-;;;;    (at your option) any later version.
-;;;;
-;;;;    This program is distributed in the hope that it will be useful,
-;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;;;    GNU Affero General Public License for more details.
-;;;;
-;;;;    You should have received a copy of the GNU Affero General Public License
-;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-;;;;**************************************************************************
-
-(asdf:defsystem "com.informatimago.linc"
-  ;; system attributes:
-  :description "LINC Is Not C, but almost.  It allows writing C code as S-exps."
-  :long-description "
-
-LINC Is Not C, but almost.
-
-The purpose is to be able to use Common Lisp
-at the meta-programming level to generate C sources.
-Linc programs can also be executed and debugged in the
-Common Lisp environment.
-
-A linc file contains normal Common Lisp expressions,
-and linc expressions.  When compiling the linc file,
-the Common Lisp expressions are executed, which will
-generate a corresponding C source.
-
-"
-  :author     "Pascal J. Bourguignon <pjb@informatimago.com>"
-  :maintainer "Pascal J. Bourguignon <pjb@informatimago.com>"
-  :licence "AGPL3"
-  ;; component attributes:
-  :version "0.0.3"
-  :properties ((#:author-email                   . "pjb@informatimago.com")
-               (#:date                           . "2007")
-               ((#:albert #:output-dir)          . "../documentation/com.informatimago.linc/")
-               ((#:albert #:formats)             . ("docbook"))
-               ((#:albert #:docbook #:template)  . "book")
-               ((#:albert #:docbook #:bgcolor)   . "white")
-               ((#:albert #:docbook #:textcolor) . "black"))
-  #+asdf-unicode :encoding #+asdf-unicode :utf-8
-  :depends-on ("split-sequence"
-               "closer-mop"
-               "com.informatimago.common-lisp.cesarum")
-  :components ((:file "packages")
-               (:file "c-syntax"           :depends-on ("packages"))
-               (:file "c-operators"        :depends-on ("packages" "c-syntax"))
-               ;; Not yet (:file "c++-syntax"         :depends-on ("packages"))
-               (:file "linc"               :depends-on ("packages" "c-syntax" "c-operators")))
-  #+adsf3 :in-order-to #+adsf3 ((asdf:test-op (asdf:test-op "com.informatimago.linc.test"))))
-
-;;;; THE END ;;;;
diff --git a/languages/linc/com.informatimago.linc.test.asd b/languages/linc/com.informatimago.linc.test.asd
deleted file mode 100644
index fcc5116..0000000
--- a/languages/linc/com.informatimago.linc.test.asd
+++ /dev/null
@@ -1,69 +0,0 @@
-;;;; -*- mode:lisp;coding:utf-8 -*-
-;;;;***************************************************************************
-;;;;FILE:                com.informatimago.linc.test.asd
-;;;;LANGUAGE:            Common-Lisp
-;;;;SYSTEM:              None
-;;;;USER-INTERFACE:      None
-;;;;DESCRIPTION:
-;;;;
-;;;;    This file defines the com.informatimago.linc.test system.
-;;;;    Tests the com.informatimago.linc system.
-;;;;
-;;;;USAGE:
-;;;;
-;;;;AUTHORS:
-;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
-;;;;MODIFICATIONS:
-;;;;    2015-02-23 <PJB> Created.
-;;;;BUGS:
-;;;;
-;;;;LEGAL:
-;;;;
-;;;;    AGPL3
-;;;;
-;;;;    Copyright Pascal J. Bourguignon 2015 - 2015
-;;;;
-;;;;    This program is free software: you can redistribute it and/or modify
-;;;;    it under the terms of the GNU Affero General Public License as published by
-;;;;    the Free Software Foundation, either version 3 of the License, or
-;;;;    (at your option) any later version.
-;;;;
-;;;;    This program is distributed in the hope that it will be useful,
-;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;;;    GNU Affero General Public License for more details.
-;;;;
-;;;;    You should have received a copy of the GNU Affero General Public License
-;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>
-;;;;
-;;;;***************************************************************************
-
-(asdf:defsystem "com.informatimago.linc.test"
-  ;; system attributes:
-  :description    "Tests the com.informatimago.linc system."
-  :author         "Pascal J. Bourguignon <pjb@informatimago.com>"
-  :maintainer     "Pascal J. Bourguignon <pjb@informatimago.com>"
-  :licence        "AGPL3"
-  ;; component attributes:
-  :version        "1.0.3"
-  :properties     ((#:author-email . "pjb@informatimago.com")
-                   (#:date . "Winter 2015")
-                   ((#:albert #:output-dir)
-                    . "/tmp/documentation/com.informatimago.linc.test/")
-                   ((#:albert #:formats) "docbook")
-                   ((#:albert #:docbook #:template) . "book")
-                   ((#:albert #:docbook #:bgcolor) . "white")
-                   ((#:albert #:docbook #:textcolor) . "black"))
-  #+asdf-unicode :encoding #+asdf-unicode :utf-8
-  :depends-on     ("com.informatimago.common-lisp.cesarum"
-                   "com.informatimago.linc")
-  :components     ()
-  #+asdf3 :perform #+asdf3 (asdf:test-op
-                            (operation system)
-                            (declare (ignore operation system))
-                            ;; (let ((*package* (find-package "TESTED-PACKAGE")))
-                            ;;   (uiop:symbol-call "TESTED-PACKAGE"
-                            ;;                             "TEST/ALL"))
-                            ))
-
-;;;; THE END ;;;;
diff --git a/rdp/packages.lisp b/rdp/packages.lisp
index 98177ce..59c7ddc 100644
--- a/rdp/packages.lisp
+++ b/rdp/packages.lisp
@@ -41,6 +41,7 @@
         "COM.INFORMATIMAGO.COMMON-LISP.CESARUM.LIST"
         "COM.INFORMATIMAGO.COMMON-LISP.REGEXP.REGEXP"
         "COM.INFORMATIMAGO.COMMON-LISP.PARSER.SCANNER"
+        "COM.INFORMATIMAGO.COMMON-LISP.PARSER.PARSER"
         )
   (:export "DEFGRAMMAR" "SEQ" "REP" "OPT" "ALT" "GRAMMAR-NAMED"
            "GENERATE-GRAMMAR"
diff --git a/rdp/rdp.lisp b/rdp/rdp.lisp
index 535d1a5..efebf7d 100644
--- a/rdp/rdp.lisp
+++ b/rdp/rdp.lisp
@@ -66,8 +66,19 @@
   first-function
   follow-function)

-
-
+(defun dump-grammar (grammar)
+  (format t "(defgrammar ~S~%" (grammar-name grammar))
+  (format t "  :terminals ~S~%" (grammar-terminals grammar))
+  (format t "  :start ~S~%" (grammar-start grammar))
+  (format t "  :rules ~S~%" (grammar-rules grammar))
+  (format t "  :all-terminals ~S~%" (grammar-all-terminals grammar))
+  (format t "  :all-non-terminals ~S~%" (grammar-all-non-terminals grammar))
+  (format t "  :scanner ~S~%" (grammar-scanner grammar))
+  (format t "  :skip-spaces ~S~%" (grammar-skip-spaces grammar))
+  (format t "  :first-function ~S~%" (grammar-first-function grammar))
+  (format t "  :follow-function ~S~%" (grammar-follow-function grammar))
+  (format t ")~%")
+  grammar)

 (defvar *grammars* (make-hash-table)
   "Records the variables defined with DEFGRAMMAR.
ViewGit