Commit 6253154f authored by david_v's avatar david_v
Browse files

2003-06-20 Valentin David <valentin@lrde.epita.fr>

	* configure.ac: Add --with-detgen option.

	* src/import-cxx-cons/Makefile.am: Deleted.
	* src/import-cxx-cons/import-cxx-cons.str: Deleted.
	* src/Makefile.am: Delete empty subdirs.

	* src/syn/ClassSpecifiers.sdf,
	* src/syn/EnumSpecifiers.sdf,
	* src/syn/Expressions.sdf,
	* src/syn/IdExpressions.sdf,
	* src/syn/Makefile.am,
	* src/syn/Namespaces.sdf,
	* src/syn/SimpleTypeSpecifiers.sdf,
	* src/syn/Specifiers.sdf:
	Add det tags to generate Dxx.

	* src/deterministic/Makefile.am: Generate the Dxx grammar.
	* src/deterministic/Dxx-main.sdf: Deleted.
	* src/deterministic/Dxx-nocons.sdf: Deleted.
	* src/deterministic/Dxx.sdf: New.

	* src/sdf/Makefile.am: Update.
parent 0c138f15
2003-06-20 Valentin David <valentin@lrde.epita.fr>
* configure.ac: Add --with-detgen option.
* src/import-cxx-cons/Makefile.am: Deleted.
* src/import-cxx-cons/import-cxx-cons.str: Deleted.
* src/Makefile.am: Delete empty subdirs.
* src/syn/ClassSpecifiers.sdf,
* src/syn/EnumSpecifiers.sdf,
* src/syn/Expressions.sdf,
* src/syn/IdExpressions.sdf,
* src/syn/Makefile.am,
* src/syn/Namespaces.sdf,
* src/syn/SimpleTypeSpecifiers.sdf,
* src/syn/Specifiers.sdf:
Add det tags to generate Dxx.
* src/deterministic/Makefile.am: Generate the Dxx grammar.
* src/deterministic/Dxx-main.sdf: Deleted.
* src/deterministic/Dxx-nocons.sdf: Deleted.
* src/deterministic/Dxx.sdf: New.
* src/sdf/Makefile.am: Update.
2003-06-18 Valentin David <valentin@lrde.epita.fr>
* src/import-cxx-cons/import-cxx-cons.str:
......
......@@ -22,20 +22,36 @@ AM_INIT_AUTOMAKE([1.7.3 dist-bzip2])
USE_XT_PACKAGES
test "x$prefix" = xNONE && prefix=$ac_default_prefix
AC_ARG_WITH(lrde-sdftools,
[ --with-lrde-sdftools=DIR Specify location of LRDE_SDF, [PREFIX]],
LRDE_SDF="$withval",
LRDE_SDF="$prefix"
)
AC_SUBST(LRDE_SDF)
AC_ARG_WITH(sdf-option,
[ --with-sdf-option=DIR Specify location of SDF_OPTION, [PREFIX]],
[ --with-sdf-option=DIR Specify location of SDF_OPTION, [LRDE_SDF]],
SDF_OPTION="$withval",
SDF_OPTION="$prefix"
SDF_OPTION="$LRDE_SDF"
)
AC_SUBST(SDF_OPTION)
AC_ARG_WITH(boxedsdf,
[ --with-boxedsdf=DIR Specify location of BOXEDSDF, [PREFIX]],
[ --with-boxedsdf=DIR Specify location of BOXEDSDF, [LRDE_SDF]],
BOXEDSDF="$withval",
BOXEDSDF="$prefix"
BOXEDSDF="$LRDE_SDF"
)
AC_SUBST(BOXEDSDF)
AC_ARG_WITH(detgen,
[ --with-detgen=DIR Specify location of DETGEN, [LRDE_SDF]],
DETGEN="$withval",
DETGEN="$LRDE_SDF"
)
AC_SUBST(DETGEN)
# Loook for common programs
AC_LANG_C
AC_PROG_CC
......@@ -50,7 +66,6 @@ AC_SUBST(COMPILER_SYNTAX_CHECK)
# Output Files
AC_CONFIG_FILES([Makefile
src/Makefile
src/import-cxx-cons/Makefile
src/syn/Makefile
src/cxxsdf/Makefile
src/deterministic/Makefile
......
;; -*- Prcs -*-
(Created-By-Prcs-Version 1 3 2)
(Project-Description "Meta/SDF Grammar for C++")
(Project-Version meta-c++-grammar 0 116)
(Parent-Version meta-c++-grammar 0 115)
(Version-Log "2003-06-18 Valentin David <valentin@lrde.epita.fr>
(Project-Version meta-c++-grammar 0 117)
(Parent-Version meta-c++-grammar 0 116)
(Version-Log "2003-06-20 Valentin David <valentin@lrde.epita.fr>
* src/import-cxx-cons/import-cxx-cons.str:
Accept markups at any place.
* configure.ac: Add --with-detgen option.
* src/deterministic/Dxx-nocons.sdf:
Fix PP for OriginalNamespace, and add some bracket attributes.
* src/import-cxx-cons/Makefile.am: Deleted.
* src/import-cxx-cons/import-cxx-cons.str: Deleted.
* src/Makefile.am: Delete empty subdirs.
* src/syn/ClassSpecifiers.sdf,
* src/syn/EnumSpecifiers.sdf,
* src/syn/Expressions.sdf,
* src/syn/IdExpressions.sdf,
* src/syn/Makefile.am,
* src/syn/Namespaces.sdf,
* src/syn/SimpleTypeSpecifiers.sdf,
* src/syn/Specifiers.sdf:
Add det tags to generate Dxx.
* src/deterministic/Makefile.am: Generate the Dxx grammar.
* src/deterministic/Dxx-main.sdf: Deleted.
* src/deterministic/Dxx-nocons.sdf: Deleted.
* src/deterministic/Dxx.sdf: New.
* src/sdf/Makefile.am: Update.
")
(New-Version-Log "")
(Checkin-Time "Wed, 18 Jun 2003 18:15:49 +0200")
(Checkin-Time "Fri, 20 Jun 2003 16:33:37 +0200")
(Checkin-Login david_v)
(Populate-Ignore
(
......@@ -82,15 +99,15 @@
)
(Project-Keywords)
(Files
(ChangeLog (meta-c++-grammar/0_ChangeLog 1.112 600))
(ChangeLog (meta-c++-grammar/0_ChangeLog 1.113 600))
(Makefile.am (meta-c++-grammar/f/34_Makefile.a 1.11 644))
(README (meta-c++-grammar/g/37_README 1.4 600))
(config/Makefile.am (meta-c++-grammar/f/40_Makefile.a 1.4 644))
(config/sdf-check.in (meta-c++-grammar/f/37_sdf-check. 1.7 600))
(configure.ac (meta-c++-grammar/f/44_configure. 1.24 600))
(configure.ac (meta-c++-grammar/f/44_configure. 1.25 600))
(src/syn/Layout.sdf (meta-c++-grammar/4_Layout.sdf 1.3 644))
(prj (meta-c++-grammar.prj) :symlink)
(src/Makefile.am (meta-c++-grammar/f/46_Makefile.a 1.16 644))
(src/Makefile.am (meta-c++-grammar/f/46_Makefile.a 1.17 644))
(src/syn/AccessSpecifiers.sdf (meta-c++-grammar/5_AccessSpec 1.4 644))
(src/syn/AdditiveExpressions.sdf (meta-c++-grammar/6_AdditiveEx 1.7 644))
(src/syn/AndExpressions.sdf (meta-c++-grammar/7_AndExpress 1.6 644))
......@@ -101,7 +118,7 @@
(src/syn/CastExpressions.sdf (meta-c++-grammar/12_CastExpres 1.6 644))
(src/syn/CharacterLiterals.sdf (meta-c++-grammar/13_CharacterL 1.3 644))
(src/syn/Characters.sdf (meta-c++-grammar/14_Characters 1.2 644))
(src/syn/ClassSpecifiers.sdf (meta-c++-grammar/15_ClassSpeci 1.7 644))
(src/syn/ClassSpecifiers.sdf (meta-c++-grammar/15_ClassSpeci 1.8 644))
(src/syn/CompoundStatements.sdf (meta-c++-grammar/16_CompoundSt 1.5 644))
(src/syn/ConditionalExpressions.sdf (meta-c++-grammar/17_Conditiona 1.5 644))
(src/syn/ConstantExpressions.sdf (meta-c++-grammar/18_ConstantEx 1.2 644))
......@@ -114,7 +131,7 @@
(src/syn/Declarators.sdf (meta-c++-grammar/24_Declarator 1.4 644))
(src/syn/DeleteExpressions.sdf (meta-c++-grammar/25_DeleteExpr 1.5 644))
(src/syn/ElaboratedTypeSpecifiers.sdf (meta-c++-grammar/26_Elaborated 1.6 644))
(src/syn/EnumSpecifiers.sdf (meta-c++-grammar/27_EnumSpecif 1.6 644))
(src/syn/EnumSpecifiers.sdf (meta-c++-grammar/27_EnumSpecif 1.7 644))
(src/syn/EqualityExpressions.sdf (meta-c++-grammar/28_EqualityEx 1.6 644))
(src/syn/EscapeSequences.sdf (meta-c++-grammar/29_EscapeSequ 1.2 644))
(src/syn/ExceptionSpecifications.sdf (meta-c++-grammar/30_ExceptionS 1.5 644))
......@@ -122,11 +139,11 @@
(src/syn/ExplicitInstantiations.sdf (meta-c++-grammar/32_ExplicitIn 1.5 644))
(src/syn/ExplicitSpecializations.sdf (meta-c++-grammar/33_ExplicitSp 1.5 644))
(src/syn/ExpressionStatements.sdf (meta-c++-grammar/34_Expression 1.5 644))
(src/syn/Expressions.sdf (meta-c++-grammar/35_Expression 1.6 644))
(src/syn/Expressions.sdf (meta-c++-grammar/35_Expression 1.7 644))
(src/syn/FloatingLiterals.sdf (meta-c++-grammar/36_FloatingLi 1.3 644))
(src/syn/FunctionDefinitions.sdf (meta-c++-grammar/37_FunctionDe 1.6 644))
(src/syn/FunctionSpecifiers.sdf (meta-c++-grammar/38_FunctionSp 1.4 644))
(src/syn/IdExpressions.sdf (meta-c++-grammar/39_IdExpressi 1.7 644))
(src/syn/IdExpressions.sdf (meta-c++-grammar/39_IdExpressi 1.8 644))
(src/syn/Identifiers.sdf (meta-c++-grammar/40_Identifier 1.7 644))
(src/syn/InclusiveOrExpressions.sdf (meta-c++-grammar/41_InclusiveO 1.5 644))
(src/syn/InitDeclarators.sdf (meta-c++-grammar/42_InitDeclar 1.7 644))
......@@ -140,11 +157,11 @@
(src/syn/Literals.sdf (meta-c++-grammar/50_Literals.s 1.3 644))
(src/syn/LogicalAndExpressions.sdf (meta-c++-grammar/51_LogicalAnd 1.5 644))
(src/syn/LogicalOrExpressions.sdf (meta-c++-grammar/b/0_LogicalOrE 1.5 644))
(src/syn/Makefile.am (meta-c++-grammar/f/47_Makefile.a 1.15 644))
(src/syn/Makefile.am (meta-c++-grammar/f/47_Makefile.a 1.16 644))
(src/syn/MemberSpecifications.sdf (meta-c++-grammar/b/1_MemberSpec 1.7 644))
(src/syn/MultiplicativeExpressions.sdf (meta-c++-grammar/b/2_Multiplica 1.6 644))
(src/syn/NamespaceAliases.sdf (meta-c++-grammar/b/3_NamespaceA 1.5 644))
(src/syn/Namespaces.sdf (meta-c++-grammar/b/4_Namespaces 1.6 644))
(src/syn/Namespaces.sdf (meta-c++-grammar/b/4_Namespaces 1.7 644))
(src/syn/NewExpressions.sdf (meta-c++-grammar/b/5_NewExpress 1.7 644))
(src/syn/OperatorFunctionIds.sdf (meta-c++-grammar/b/6_OperatorFu 1.6 644))
(src/syn/ParameterDeclarations.sdf (meta-c++-grammar/b/7_ParameterD 1.6 644))
......@@ -154,8 +171,8 @@
(src/syn/RelationalExpressions.sdf (meta-c++-grammar/b/11_Relational 1.6 644))
(src/syn/SelectionStatements.sdf (meta-c++-grammar/b/12_SelectionS 1.6 644))
(src/syn/ShiftExpressions.sdf (meta-c++-grammar/b/13_ShiftExpre 1.6 644))
(src/syn/SimpleTypeSpecifiers.sdf (meta-c++-grammar/b/14_SimpleType 1.7 644))
(src/syn/Specifiers.sdf (meta-c++-grammar/b/15_Specifiers 1.7 644))
(src/syn/SimpleTypeSpecifiers.sdf (meta-c++-grammar/b/14_SimpleType 1.8 644))
(src/syn/Specifiers.sdf (meta-c++-grammar/b/15_Specifiers 1.8 644))
(src/syn/Statements.sdf (meta-c++-grammar/b/16_Statements 1.2 644))
(src/syn/StorageClassSpecifiers.sdf (meta-c++-grammar/b/17_StorageCla 1.4 644))
(src/syn/StringLiterals.sdf (meta-c++-grammar/b/18_StringLite 1.3 644))
......@@ -170,7 +187,7 @@
(src/syn/UnaryExpressions.sdf (meta-c++-grammar/b/27_UnaryExpre 1.8 644))
(src/syn/UsingDeclarations.sdf (meta-c++-grammar/b/28_UsingDecla 1.5 644))
(src/syn/UsingDirectives.sdf (meta-c++-grammar/b/29_UsingDirec 1.6 644))
(src/deterministic/Makefile.am (meta-c++-grammar/g/39_Makefile.a 1.9 644))
(src/deterministic/Makefile.am (meta-c++-grammar/g/39_Makefile.a 1.10 644))
(test/Makefile.am (meta-c++-grammar/f/45_Makefile.a 1.5 644))
(test/g++/abi/bitfield1.C (meta-c++-grammar/b/30_bitfield1. 1.1 600))
(test/g++/abi/bitfield2.C (meta-c++-grammar/b/31_bitfield2. 1.1 600))
......@@ -400,21 +417,38 @@
(src/pp/unbox.str (meta-c++-grammar/g/46_unbox.str 1.1 600))
(src/pp/pp-cxx.str (meta-c++-grammar/g/47_pp-cpp.str 1.4 600))
(src/pp/Makefile.am (meta-c++-grammar/g/48_Makefile.a 1.7 644))
(src/sdf/Makefile.am (meta-c++-grammar/g/50_Makefile.a 1.3 644))
(src/sdf/Makefile.am (meta-c++-grammar/g/50_Makefile.a 1.4 644))
(src/strategocxx/CxxVariables.sdf (meta-c++-grammar/g/51_CxxVariabl 1.2 644))
(src/strategocxx/StrategoCxx.sdf (meta-c++-grammar/h/0_StrategoCx 1.2 644))
(src/strategocxx/Makefile.am (meta-c++-grammar/h/1_Makefile.a 1.4 644))
(src/pp/Options.pp (meta-c++-grammar/h/2_Options.pp 1.1 644))
(src/pp/pp-dxx.str (meta-c++-grammar/h/3_pp-dxx.str 1.1 600))
(src/cxxsdf/Makefile.am (meta-c++-grammar/h/4_Makefile.a 1.2 644))
(src/deterministic/Dxx-main.sdf (meta-c++-grammar/h/5_Dxx-main.s 1.1 600))
(src/import-cxx-cons/Makefile.am (meta-c++-grammar/h/6_Makefile.a 1.2 644))
(src/import-cxx-cons/import-cxx-cons.str (meta-c++-grammar/h/7_import-cxx 1.2 644))
(src/deterministic/Dxx-nocons.sdf (meta-c++-grammar/h/8_Dxx-nocons 1.2 600))
(NEWS (meta-c++-grammar/h/11_NEWS 1.1 644))
(AUTHORS (meta-c++-grammar/h/12_AUTHORS 1.1 644))
(INSTALL (meta-c++-grammar/h/13_INSTALL 1.1 644))
(COPYING (meta-c++-grammar/h/14_COPYING 1.1 644))
;; Files deleted by depopulate at Fri, 20 Jun 2003 16:23:19 +0200,
;; from version 0.116(w), by david_v:
; (src/import-cxx-cons/Makefile.am ())
; (src/import-cxx-cons/import-cxx-cons.str ())
;; Files deleted by depopulate at Fri, 20 Jun 2003 16:23:53 +0200,
;; from version 0.116(w), by david_v:
; (src/deterministic/Dxx-main.sdf ())
; (src/deterministic/Dxx-nocons.sdf ())
;; Files added by populate at Fri, 20 Jun 2003 16:26:11 +0200,
;; to version 0.116(w), by david_v:
(src/deterministic/Dxx.sdf (meta-c++-grammar/h/15_Dxx.sdf 1.1 600))
)
(Merge-Parents)
(New-Merge-Parents)
include $(top_srcdir)/config/Makefile.xt
SUBDIRS = import-cxx-cons \
syn cxxsdf \
deterministic sig \
pp sdf strategocxx
SUBDIRS = syn \
cxxsdf \
deterministic \
sig \
pp \
sdf \
strategocxx
BOOTCLEAN_SUBDIRS = $(SUBDIRS)
module Dxx
imports
Cxx
exports
sorts
TranslationUnit
context-free syntax
%% Introduce specific comments that will act as source code
%% annotations. Of course, they should not be parsed as layout.
"/*[al]*/" -> LAYOUT { reject } %% NamespaceAlias
"/*[cl]*/" -> LAYOUT { reject } %% ClassName
"/*[en]*/" -> LAYOUT { reject } %% EnumName
"/*[ns]*/" -> LAYOUT { reject } %% OriginalNamespaceName
"/*[tn]*/" -> LAYOUT { reject } %% TypedefName
"/*[dss]*/" -> LAYOUT { reject } %% DeclSpecifierSeq
"/*[nns]*/" -> LAYOUT { reject } %% NestedNameSpecifier
"/*[uid]*/" -> LAYOUT { reject } %% UnqualifiedId
"/*[qid]*/" -> LAYOUT { reject } %% QualifiedId
"/*[org]*/" -> LAYOUT { reject } %% OriginalNamespaceDefinition
"/*[etor]*/" -> LAYOUT { reject } %% Enumerator
"/*[expr]*/" -> LAYOUT { reject } %% Expression
"/*[!al]*/" -> LAYOUT { reject }
"/*[!cl]*/" -> LAYOUT { reject }
"/*[!en]*/" -> LAYOUT { reject }
"/*[!ns]*/" -> LAYOUT { reject }
"/*[!tn]*/" -> LAYOUT { reject }
"/*[!dss]*/" -> LAYOUT { reject }
"/*[!nns]*/" -> LAYOUT { reject }
"/*[!uid]*/" -> LAYOUT { reject }
"/*[!qui]*/" -> LAYOUT { reject }
"/*[!org]*/" -> LAYOUT { reject }
"/*[!etor]*/" -> LAYOUT { reject }
"/*[!expr]*/" -> LAYOUT { reject }
%% 5.1 [expr.prim]
%% Ambiguous rules in: grammar/IdExpressions.sdf
"/*[uid]*/" Identifier "/*[!uid]*/" -> UnqualifiedId { prefer, pp(H hs=0[KW["/*[uid]*/"] _1 KW["/*[!uid]*/"]]) }
"/*[uid]*/" TemplateId "/*[!uid]*/" -> UnqualifiedId { prefer, pp(H hs=0[KW["/*[uid]*/"] _1 KW["/*[!uid]*/"]]) }
"/*[qid]*/" "::" Identifier "/*[!qid]*/" -> QualifiedId { prefer, pp(H hs=0[KW["/*[qid]*/::"] _1 KW["/*[!qid]*/"]]) }
"/*[qid]*/" "::" TemplateId "/*[!qid]*/" -> QualifiedId { prefer, pp(H hs=0[KW["/*[qid]*/::"] _1 KW["/*[!qid]*/"]]) }
"/*[nns]*/" NestedNameSpecifier "/*[!nns]*/" -> NestedNameSpecifier { prefer, pp(H hs=0[KW["/*[nns]*/"] _1 KW["/*[!nns]*/"]]), bracket }
%% 5.18 [expr.comma]
%% Ambiguous rules in: grammar/Expressions.sdf
"/*[expr]*/" Expression "/*[!expr]*/" -> Expression { prefer, pp(H hs=0[KW["/*[expr]*/"] _1 KW["/*[!expr]*/"]]), bracket }
%% 7.1 [dcl.spec]
%% Ambiguous rules in: grammar/Specifiers.sdf
"/*[dss]*/" DeclSpecifier+ "/*[!dss]*/" -> DeclSpecifierSeq { prefer, pp(H hs=0[KW["/*[dss]*/"] _1 KW["/*[!dss]*/"]]) }
%% 7.2 [dcl.enum]
%% Ambiguous rules in: grammar/EnumSpecifiers.sdf
"/*[en]*/" Identifier "/*[!en]*/" -> EnumName { prefer, pp(H hs=0[KW["/*[en]*/"] _1 KW["/*[!en]*/"]]) }
"/*[etor]*/" Identifier "/*[!etor]*/" -> Enumerator { prefer, pp(H hs=0[KW["/*[etor]*/"] _1 KW["/*[!etor]*/"]]) }
%% 7.3.1 [namespace.def]
%% Ambiguous rules in: grammar/Namespaces.sdf
"/*[ns]*/" Identifier "/*[!ns]*/" -> OriginalNamespaceName { prefer, pp(H hs=0[KW["/*[ns]*/"] _1 KW["/*[!ns]*/"]]) }
"/*[al]*/" Identifier "/*[!al]*/" -> NamespaceAlias { prefer, pp(H hs=0[KW["/*[al]*/"] _1 KW["/*[!al]*/"]]) }
"namespace" "/*[org]*/" Identifier "/*[!org]*/" "{" NamespaceBody "}" -> OriginalNamespaceDefinition { prefer, pp(V [H [KW["namespace"] H hs=0[KW["/*[org]*/"] _1 KW["/*[!org]*/"]]] V is=2 [KW["{"] _2] KW["}"]]) }
%% 9 [class]
%% Ambiguous rules in: grammar/ClassSpecifiers.sdf
"/*[cl]*/" Identifier "/*[!cl]*/" -> ClassName { prefer, pp(H hs=0[KW["/*[cl]*/"] _1 KW["/*[!cl]*/"]]) }
"/*[cl]*/" TemplateId "/*[!cl]*/" -> ClassName { prefer, pp(H hs=0[KW["/*[cl]*/"] _1 KW["/*[!cl]*/"]]) }
%% A.1 [gram.key]
%% Ambiguous rules in: grammar/SimpleTypeSpecifiers.sdf
"/*[tn]*/" Identifier "/*[!tn]*/" -> TypedefName { prefer, pp(H hs=0[KW["/*[tn]*/"] _1 KW["/*[!tn]*/"]]) }
......@@ -4,36 +4,34 @@ PGEN_FLAGS = -m $*
pkgdata_DATA = Dxx.def Dxx.tbl Dxx.pp.af
EXTRA_DIST = \
Dxx-nocons.sdf \
Dxx-main.sdf
EXTRA_DIST = Dxx.sdf
SDFS = \
Dxx.sdf
Dxx.sdf \
DetCxx.sdf
Dxx.sdf: Dxx-nocons.sdf
$(BOXEDSDF)/bin/parse-boxedsdf -i $< | \
env XTC_REPOSITORY=$(BOXEDSDF)/share/boxedsdf/XTC \
$(top_builddir)/src/import-cxx-cons/import-cxx-cons \
-c $(top_builddir)/src/syn/Cxx.ppdef | \
$(BOXEDSDF)/bin/pp-boxedsdf -o $@
DetCxx.sdf:
$(DETGEN)/bin/det-gen -m Cxx -i $(top_builddir)/src/syn/Cxx.ppdef -o $@
Dxx.def: Dxx.ppdef
$(BOXEDSDF)/bin/parse-boxedsdf -i $< | \
$(DETGEN)/bin/parse-detboxedsdf -i $< | \
$(DETGEN)/bin/det2sdf | \
$(BOXEDSDF)/bin/boxed2sdf | \
$(GPP)/bin/pp-sdf -o $@
Dxx.pp: Dxx.ppdef
$(BOXEDSDF)/bin/parse-boxedsdf -i $< | \
$(DETGEN)/bin/parse-detboxedsdf -i $< | \
$(BOXEDSDF)/bin/boxed2pp-table | \
$(GPP)/bin/pp-pp-table -o $@
Dxx.ppdef: $(SDFS)
$(BOXEDSDF)/bin/pack-boxedsdf \
-s DetBoxedSdf \
-I $(DETGEN)/share/sdf-detgen \
-I $(top_srcdir)/lib \
-I $(top_builddir)/src/cxxsdf \
-I $(top_builddir)/src/deterministic \
-i $(top_srcdir)/src/deterministic/Dxx-main.sdf \
-i $(top_srcdir)/src/deterministic/Dxx.sdf \
| $(ASFIX_TOOLS)/bin/asfix-yield -o $@
CLEANFILES = Dxx.def Dxx.tbl Dxx.pp Dxx.pp.af Dxx.ppdef Dxx.sdf
CLEANFILES = Dxx.def Dxx.tbl Dxx.pp Dxx.pp.af Dxx.ppdef DetCxx.sdf
include $(top_srcdir)/config/Makefile.xt
-include import-cxx-cons.c.dep
noinst_PROGRAMS = import-cxx-cons
SCFLAGS = --main $* --verbose 0
STRINCLUDES = -I $(BOXEDSDF)/share/boxedsdf \
-I $(XTC)/share/xtc
CLEANFILES = import-cxx-cons.c.dep
BOOTCLEANFILES = import-cxx-cons.c
/**
* Cxx Grammar
* Copyright (C) 2003 LRDE
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* import-cxx-cons
*
* Put constructors on Dxx grammar so as to be the same as Cxx ones.
*
* Author: Valentin David <valentin@lrde.epita.fr>
*/
module import-cxx-cons
imports BoxedSdf2 lib xtc-lib stratego-xt-xtc-tools
signature
constructors
CxxGrammar : String -> Option
rules
/**
* :: String -> Term
*
* Parse the Cxx grammar file
*/
readtxtpp : infile -> tree
where xtc-temp-files(<xtc-transform(!"sglr",
!["-2", "-p", <xtc-find>"BoxedSdf2.tbl"])> FILE(infile)
; xtc-implode-asfix
; read-from => tree)
strategies
/**
* -c/--cxx grammar
* to specify the pp table
*/
cxx-option =
ArgOption("-c" + "--cxx"
, where(<set-config> ("-c",<id>)); !CxxGrammar(<id>)
, !"-c f|--cxx f Read cxx grammar from f"
)
/**
* iowrap with the new option.
*/
my-iowrap(s) =
iowrap(
(
(option-defined(?CxxGrammar(cxx)), id)
; (id, \ i -> (i,<readtxtpp> cxx) \)
<+ !"bad -c option, try --help."; debug; giving-up)
; (id, s)
, cxx-option)
rules
EmmitProd : p@prod(a,b,c) -> p
where <at-cons(?cons)> c
; rules(ProdTable : (b, a) -> cons)
PutCons : prod(a,b,c) -> prod(a,b,c')
where <delmarkup> a
; !(b, <id>)
; ProdTable => cs
; <no-attrs
; !attrs(cons(cs))
<+ at-cons(!cons(cs))
<+ attrs(![cons(cs)|<id>])> c => c'
strategies
/**
* Main strategy
*/
import-cxx-cons = my-iowrap(
(id, collect(?prod(_,_,_)))
; ?(i, c)
; !c
; {| ProdTable:
map(try(EmmitProd))
; !i
; putcons
|}
)
putcons =
alltd(lexical-syntax(id)
<+ context-free-priorities(id)
<+ lexical-priorities(id)
<+ priorities(id)
<+
(prod(id,id,id)
; (prod([lit(id)],layout,attrs([reject]))
<+ try(PutCons)))
)
/**
* Test if a literal is a comment
*/
iscomment = explode-string
; [47|[42|id]]
; rec x([42,47] <+ [id|x])
/**
* Delete markups.
*/
delmarkup = map(\ lit(l) -> []
where <un-double-quote> l
; iscomment \
<+ ![<id>])
; concat
at-cons(s) = oncetd(cons(s))
......@@ -33,8 +33,8 @@ SDFS = \
Declarations.sdf \
Declarators.sdf \
DeleteExpressions.sdf \
DetCxx.sdf \
Dxx.sdf \
Dxx-main.sdf \
ElaboratedTypeSpecifiers.sdf \
EnumSpecifiers.sdf \
EqualityExpressions.sdf \
......
......@@ -20,8 +20,8 @@ exports
context-free syntax
%% 9 [class]
Identifier -> ClassName
TemplateId -> ClassName
Identifier -> ClassName {dettag("cl")}
TemplateId -> ClassName {dettag("cl")}
%% 9 [class]
ClassHead "{" MemberSpecification? "}" -> ClassSpecifier
......
......@@ -14,7 +14,7 @@ exports
context-free syntax
%% 7.2 [dcl.enum]
Identifier -> EnumName
Identifier -> EnumName {dettag("en")}
%% 7.2 [dcl.enum]
"enum" Identifier? "{" EnumeratorList? "}" -> EnumSpecifier
......@@ -30,4 +30,4 @@ exports
{pp(H[_1 H[KW["="] _2]])}
%% 7.2 [dcl.enum]
Identifier -> Enumerator
Identifier -> Enumerator {dettag("etor")}
......@@ -14,4 +14,4 @@ exports
%% 5.18 [expr.comma]
{ AssignmentExpression "," }+ -> Expression
{pp(H[_1], .1:iter-sep=H hs=0[_1 KW[","]])}
{pp(H[_1], .1:iter-sep=H hs=0[_1 KW[","]]), dettag("expr")}
......@@ -26,28 +26,28 @@ exports
QualifiedId -> IdExpression
%% 5.1 [expr.prim]
Identifier -> UnqualifiedId
Identifier -> UnqualifiedId {dettag("uid")}
OperatorFunctionId -> UnqualifiedId
ConversionFunctionId -> UnqualifiedId
"~" ClassName -> UnqualifiedId
{pp(H[KW["~"] _1])}
TemplateId -> UnqualifiedId
TemplateId -> UnqualifiedId {dettag("uid")}
%% 5.1 [expr.prim]
"::"? NestedNameSpecifier "template"? UnqualifiedId -> QualifiedId
{pp(H[H hs=0[_1 _2] H[_3 _4]], .1:opt=KW["::"], .3:opt=KW["template"])}
"::" Identifier -> QualifiedId
{pp(H hs=0[KW["::"] _1])}
{pp(H hs=0[KW["::"] _1]), dettag("qid")}
"::" OperatorFunctionId -> QualifiedId
{pp(H hs=0[KW["::"] _1])}
"::" TemplateId -> QualifiedId
{pp(H hs=0[KW["::"] _1])}
{pp(H hs=0[KW["::"] _1]), dettag("qid")}
%% 5.1 [expr.prim]
ClassOrNamespaceName "::" NestedNameSpecifier? -> NestedNameSpecifier
{pp(H hs=0[_1 KW["::"] _2], .2:opt=_1)}
{pp(H hs=0[_1 KW["::"] _2], .2:opt=_1), dettag("nns")}
ClassOrNamespaceName "::" "template" NestedNameSpecifier -> NestedNameSpecifier
{pp(H hs=0[_1 KW["::"] H[KW["template"] _2]])}
{pp(H hs=0[_1 KW["::"] H[KW["template"] _2]]), dettag("nns")}
%% 5.1 [expr.prim]
ClassName -> ClassOrNamespaceName
......
......@@ -88,23 +88,27 @@ SDFS = \
UsingDirectives.sdf
Cxx.def: Cxx.ppdef
$(BOXEDSDF)/bin/parse-boxedsdf -i $< | \
$(DETGEN)/bin/parse-detboxedsdf -i $< | \
$(DETGEN)/bin/det2sdf | \
$(BOXEDSDF)/bin/boxed2sdf | \
$(GPP)/bin/pp-sdf -o $@