Presentation is loading. Please wait.

Presentation is loading. Please wait.

ABNF in ACL2 Alessandro Coglio Kestrel Institute Workshop 2017.

Similar presentations


Presentation on theme: "ABNF in ACL2 Alessandro Coglio Kestrel Institute Workshop 2017."— Presentation transcript:

1 ABNF in ACL2 Alessandro Coglio Kestrel Institute Workshop 2017

2 ABNF in ACL2

3 A B N F

4 Augmented Backus-Naur Form

5 Augmented Backus-Naur Form is a formal context-free grammar notation that adds conveniences and makes slight modifications to Backus-Naur Form.

6 Augmented Backus-Naur Form is a formal context-free grammar notation that adds conveniences and makes slight modifications to Backus-Naur Form, e.g.: numeric range terminal notations case-insensitive string terminal notations DIGIT = %x30-39 HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F" h16 = 1*4HEXDIG repetition prefixes, min. (default 0) to max. (default ∞) message-body = *OCTET RWS = 1*( SP / HTAB )

7 Augmented Backus-Naur Form

8 A B N F

9 ABNF

10 ABNF is specified by two RFCs (i.e. Internet standards).

11 ABNF is specified by two RFCs (i.e. Internet standards).

12 ABNF is specified by two RFCs (i.e. Internet standards).

13 ABNF is specified by two RFCs (i.e. Internet standards).

14 ABNF is specified by two RFCs (i.e. Internet standards).

15 ABNF is specified by two RFCs (i.e. Internet standards).

16 ABNF is specified by two RFCs (i.e. Internet standards).

17 ABNF is specified by two RFCs (i.e. Internet standards).

18 ABNF specif RFCs

19 The RFCs use natural language to informally specify ABNF.

20 The RFCs use natural language to informally specify ABNF.

21 The RFCs use natural language to informally specify ABNF.

22 The RFCs use natural language to informally specify ABNF.

23 The RFCs use natural language to informally specify ABNF.

24 The RFCs use natural language to informally specify ABNF.
specifies ABNF language

25 The RFCs use natural language to informally specify ABNF.
specifies ABNF language

26 The RFCs use natural language to informally specify ABNF.
ABNF language informally specifies

27 The RFCs use natural language to informally specify ABNF.
specifies ABNF language

28 The RFCs use natural language to informally specify ABNF.
specifies ABNF language

29 The RFCs use natural language to informally specify ABNF.
specifies ABNF language

30 The RFCs use natural language to informally specify ABNF.
specifies ABNF language syntax semantics

31 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies ABNF language syntax semantics

32 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. formally specif natural language informally specifies ABNF language syntax semantics

33 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics

34 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics

35 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

36 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies semantics syntax formally ABNF language How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

37 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

38 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification? ACL2

39 ACL2 The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics ACL2 How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

40 ? The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics ? How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

41 ? The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ? syntax ABNF language semantics How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

42 ? The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics ? How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

43 ? The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax semantics ? How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

44 ? The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language semantics syn tax ? How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

45 ? The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language syntax syntax semantics ? How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

46 ? The RFCs use natural language to informally specify ABNF.
And they use ABNF to formally specify the syntax of ABNF. natural language informally specifies formally specifies ABNF language concrete syntax abstract syntax semantics ? How to formally specify ABNF in ACL2, faithfully to the RFCs, including the meta-circular formal syntax specification?

47 abstract syntax

48 abstract syntax

49 Formalize an abstract syntax

50 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF.

51 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ...

52 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ...

53 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ...

54 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... alternation = concatenation *(*c-wsp "/" *c-wsp concatenation)

55 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... alternation = concatenation * concatenation

56 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... alternation = * concatenation concatenation

57 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... alternation = concatenation *concatenation

58 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... alternation = concatenation *concatenation

59 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... alternation = *concatenation

60 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... alternation = * concatenation

61 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... = * alternation concatenation

62 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deflist alternation :elt-type concatenation)

63 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... concatenation repetition (fty::deflist alternation :elt-type concatenation)

64 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deflist alternation :elt-type concatenation) concatenation repetition)

65 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition)

66 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... repetition repeat element (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition)

67 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) repetition repeat element

68 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) (fty::defprod repetition ((range repeat-range) (element element)))

69 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... element rulename rulename group group alternation (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) (fty::defprod repetition ((range repeat-range) (element element)))

70 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) (fty::defprod repetition ((range repeat-range) (element element))) element rulename rulename group alternation

71 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) (fty::defprod repetition ((range repeat-range) (element element))) (fty::deftagsum element (:rulename ((get rulename))) (:group ((get alternation))) ...)

72 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... ... (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) (fty::defprod repetition ((range repeat-range) (element element))) (fty::deftagsum element (:rulename ((get rulename))) (:group ((get alternation))) ...)

73 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) (fty::defprod repetition ((range repeat-range) (element element))) (fty::deftagsum element (:rulename ((get rulename))) (:group ((get alternation))) ...) ...

74 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.: alternation = concatenation *(*c-wsp "/" *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element element = rulename / group / ... group = "(" *c-wsp alternation *c-wsp ")" ... (fty::deftypes alt/conc/rep/elem (fty::deflist alternation :elt-type concatenation) (fty::deflist concatenation :elt-type repetition) (fty::defprod repetition ((range repeat-range) (element element))) (fty::deftagsum element (:rulename ((get rulename))) (:group ((get alternation))) ...)

75 Formalize an abstract syntax of ABNF in ACL2, based on the ABNF grammar rules that define the concrete syntax of ABNF, e.g.:

76 ABNF ABNF grammar

77 The start nonterminal of the ABNF grammar of ABNF is rulelist.

78 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) )

79 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) )

80 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) )

81 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) ) In the abstract syntax, an ABNF grammar is a value of type rulelist.

82 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) ) In the abstract syntax, an ABNF grammar is a value of type rulelist.

83 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) ) rule In the abstract syntax, an ABNF grammar is a value of type rulelist.

84 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) ) In the abstract syntax, an ABNF grammar is a value of type rulelist. rulelist rule

85 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) ) In the abstract syntax, an ABNF grammar is a value of type rulelist. (fty::deflist rulelist :elt-type rule)

86 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) ) In the abstract syntax, an ABNF grammar is a value of type rulelist. value (fty::deflist rulelist :elt-type rule)

87 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) ) In the abstract syntax, an ABNF grammar is a value of type rulelist. (fty::deflist rulelist :elt-type rule) These values (grammars) can be operated upon in the ACL2 logic, e.g. to check their well-formedness and to compose them.

88 The start nonterminal of the ABNF grammar of ABNF is rulelist.
rulelist = 1*( rule / (*c-wsp c-nl) ) In the abstract syntax, an ABNF grammar is a value of type rulelist. (fty::deflist rulelist :elt-type rule) These values (grammars) can be operated upon in the ACL2 logic, e.g. to check their well-formedness and to compose them.

89 In the abstract syntax, an ABNF grammar is a value of type rulelist.

90 abstract syntax

91 abstract syntax

92 natural language ABNF language concrete syntax abstract syntax
informally specifies formally specifies ABNF language concrete syntax abstract syntax semantics formally specifies

93 semantics

94 semantics

95 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities.

96 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities.

97 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x = *y %d17.80 y = 2z / %d1-4 z = "a"

98 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a"

99 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" *y %d17.80

100 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" *y %d17.80

101 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" *y %d17.80

102 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y %d17.80

103 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y %d17.80

104 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" %d17.80 y y y

105 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" %d17.80 y y y

106 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" %d17.80 y y y

107 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y %d17.80

108 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y %d17.80

109 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80)

110 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" %d1-4 y y y (17 80)

111 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) %d1-4

112 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) %d1-4

113 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2)

114 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" %d1-4 y y y (17 80) (2)

115 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) %d1-4

116 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) %d1-4

117 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) (4)

118 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" z z y y y (17 80) (2) (4)

119 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4)

120 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4)

121 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" "a" y y y (17 80) (2) z z (4)

122 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) "a"

123 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) "a"

124 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) (65)

125 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" "a" y y y (17 80) (2) z z (4) (65)

126 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) (65) "a"

127 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) (65) "a"

128 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) (65) (97)

129 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: match parse tree a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) (65) (97)

130 a parse tree that matches x
Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) (65) (97) a parse tree that matches x

131 a parse tree that matches x
Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: a grammar x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) branches are organized into lists (for concatenations) of lists (for repetitions) (2) z z (4) a parse tree that matches x (65) (97)

132 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x x = *y %d17.80 y = 2z / %d1-4 z = "a" y y y (17 80) (2) z z (4) (65) (97) branches are organized into lists (for concatenations) of lists (for repetitions)

133 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a" branches lists lists

134 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x y (17 80) (2) (4) z (65) (97) branches lists lists

135 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x y (17 80) (2) (4) z (65) (97) branches tree-list-list

136 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x y (17 80) (2) (4) z (65) (97) type of parse trees (fty::deftypes trees (fty::deftagsum tree (:leafterm ((get nat-list))) (:leafrule ((get rulename))) (:nonleaf ((rulename? maybe-rulename) (branches tree-list-list)))) (fty::deflist tree-list :elt-type tree) (fty::deflist tree-list-list :elt-type tree-list))

137 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a"

138 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a"

139 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x (tree-match-element-p tree element rules) x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a"

140 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: matching relation x (tree-match-element-p tree element rules) x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a"

141 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x (tree-match-element-p tree element rules) matching relation x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a"

142 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x matching relation (tree-match-element-p tree element rules) x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a" 17 80 2 4 65 97

143 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x matching relation (tree-match-element-p tree element rules) x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a"

144 string at the leaves of the tree
Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.: x matching relation (tree-match-element-p tree element rules) x y (17 80) (2) (4) z (65) (97) x = *y %d17.80 y = 2z / %d1-4 z = "a" string at the leaves of the tree (equal (tree->string tree) string) ( )

145 Formalize a semantics of ABNF in terms of matching relations between parse trees and (abstract) syntactic entities, e.g.:

146 semantics

147 semantics

148 natural language ABNF language concrete syntax abstract syntax
informally specifies formally specifies ABNF language concrete syntax abstract syntax semantics formally specifies

149 concrete syntax

150 concrete syntax

151 Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity.

152 Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity.

153 Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.: num-val = "%" (bin-val / dec-val / hex-val) group = "(" *c-wsp alternation *c-wsp ")"

154 Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.: num-val = "%" (bin-val / dec-val / hex-val) group = "(" *c-wsp alternation *c-wsp ")"

155 Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.: num-val = "%" (bin-val / dec-val / hex-val) num-val "%" bin-val / dec-val / hex-val group = "(" *c-wsp alternation *c-wsp ")"

156 Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.: num-val = "%" (bin-val / dec-val / hex-val) num-val "%" bin-val / dec-val / hex-val group = "(" *c-wsp alternation *c-wsp ")"

157 specially crafted and named functions and macros
Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.: num-val = "%" (bin-val / dec-val / hex-val) (def-rule-const *num-val* (/_ "%" (!_ (/_ *bin-val*) (/_ *dec-val*) (/_ *hex-val*)))) specially crafted and named functions and macros group = "(" *c-wsp alternation *c-wsp ")"

158 specially crafted and named functions and macros
Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.: num-val = "%" (bin-val / dec-val / hex-val) (def-rule-const *num-val* (/_ "%" (!_ (/_ *bin-val*) (/_ *dec-val*) (/_ *hex-val*)))) specially crafted and named functions and macros group = "(" *c-wsp alternation *c-wsp ")" group "(" * c-wsp alternation * c-wsp ")"

159 specially crafted and named functions and macros
Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.: num-val = "%" (bin-val / dec-val / hex-val) (def-rule-const *num-val* (/_ "%" (!_ (/_ *bin-val*) (/_ *dec-val*) (/_ *hex-val*)))) specially crafted and named functions and macros group = "(" *c-wsp alternation *c-wsp ")" group "(" * c-wsp alternation * c-wsp ")"

160 specially crafted and named functions and macros
Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.: num-val = "%" (bin-val / dec-val / hex-val) (def-rule-const *num-val* (/_ "%" (!_ (/_ *bin-val*) (/_ *dec-val*) (/_ *hex-val*)))) specially crafted and named functions and macros group = "(" *c-wsp alternation *c-wsp ")" (def-rule-const *group* (/_ "(" (*_ *c-wsp*) *alternation* (*_ *c-wsp*) ")"))

161 Formalize the concrete syntax of ABNF by transcribing the ABNF grammar rules of ABNF “in abstract syntax”, thus breaking the meta-circularity, e.g.:

162 concrete abstract syntax

163 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities.

164 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities.

165 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: repeat () (42) DIGIT (49) (50) (48)

166 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: repeat () (42) DIGIT (49) (50) (48) 42 49 50 48

167 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: repeat () (42) DIGIT (49) (50) (48) 49 42 50 48

168 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: repeat () (42) DIGIT (49) (50) (48) "1" "*" "2" "0"

169 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: repeat () (42) DIGIT (49) (50) (48) 1 * 2

170 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: repeat () (42) DIGIT (49) (50) (48) 1 * 2

171 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: repeat () (42) DIGIT (49) (50) (48) *

172 abstraction function for repetition ranges
Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: repeat () (42) DIGIT (49) (50) (48) (:REPEAT 1 (:FINITE 20)) abstraction function for repetition ranges (equal (abstract-repeat tree) range)

173 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: rulelist rule ...

174 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: rulelist rule ... rule rule rule ... ... ... ...

175 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: rulelist rule ... rule ... ...

176 abstraction function for lists of rules
Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.: rulelist rule ... ((:RULE ...) (:RULE ...) ...) abstraction function for lists of rules (equal (abstract-rulelist tree) rules)

177 Formalize the relationship between concrete and abstract syntax via abstraction functions from parse trees of ABNF grammars to corresponding abstract syntactic entities, e.g.:

178 concrete syntax

179 concrete syntax

180 natural language ABNF language concrete syntax abstract syntax
informally specifies formally specifies ABNF language concrete syntax abstract syntax semantics formally specifies

181 ABNF language concrete syntax abstract syntax semantics
formally specifies

182 ABNF language concrete syntax abstract syntax semantics
formally specifies

183 ABNF language formally specifies

184 ABNF language ABNF formally specifies

185 ABNF is used in several Internet syntax specifications, e.g. HTTP.
ABNF language formally specifies

186 ABNF is used in several Internet syntax specifications, e.g. HTTP.
ABNF language formally specifies

187 ABNF is used in several Internet syntax specifications, e.g. HTTP.
ABNF language formally specifies

188 ABNF is used in several Internet syntax specifications, e.g. HTTP.
ABNF language formally specifies

189 ABNF is used in several Internet syntax specifications, e.g. HTTP.
ABNF language formally specifies

190 ABNF is used in several Internet syntax specifications, e.g. HTTP.
HTTP syntax ABNF language formally specifies

191 ABNF is used in several Internet syntax specifications, e.g. HTTP.
HTTP syntax formally specifies ABNF language formally specifies

192 ABNF is used in several Internet syntax specifications, e.g. HTTP.
HTTP syntax formally specifies ABNF language formally specifies

193 syntax HTTP HTTP syntax ABNF language formally specifies

194 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
formally specifies ABNF language formally specifies

195 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
formally specifies ABNF language formally specifies

196 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?

197 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?

198 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?

199 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
ABNF grammar rules of HTTP

200 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
ABNF grammar rules of HTTP

201 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
Transcribe the ABNF grammar rules of HTTP in abstract (ABNF) syntax, as done with the ABNF grammar rules of ABNF?

202 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
Transcribe Transcribe the ABNF grammar rules of HTTP in abstract (ABNF) syntax, as done with the ABNF grammar rules of ABNF?

203 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
Transcribe the ABNF grammar rules of HTTP in abstract (ABNF) syntax, as done with the ABNF grammar rules of ABNF? transcribe T

204 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
Transcribe the ABNF grammar rules of HTTP in abstract (ABNF) syntax, as done with the ABNF grammar rules of ABNF? a constant of type rulelist, representing an ABNF grammar, which has semantics in ACL2 *http-grammar* transcribe tedious and error-prone

205 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
*http-grammar*

206 How to formally specify the HTTP syntax in ACL2, faithfully to the RFC?
*http-grammar*

207 Write and use a verified parser of ABNF grammars.
How to formally specify the HTTP syntax in ACL2, faithfully to the RFC? Write and use a verified parser of ABNF grammars. grammar text file *http-grammar* copy & paste

208 Write and use a verified parser of ABNF grammars. verified parser ABNF
How to formally specify the HTTP syntax in ACL2, faithfully to the RFC? Write and use a verified parser of ABNF grammars. verified parser ABNF grammar grammar text file *http-grammar* copy & paste

209 Write and use a verified parser of ABNF grammars.
How to formally specify the HTTP syntax in ACL2, faithfully to the RFC? Write and use a verified parser of ABNF grammars. parse tree of the ABNF grammar of HTTP grammar text file rulelist ... *http-grammar* copy & paste top-level syntax abstraction function parse-grammar-from-file abstract-rulelist verified ABNF grammar parser

210 verified ABNF grammar parser

211 verified ABNF grammar parser

212 The verified ABNF grammar parser consists of 85 functions.

213 The verified ABNF grammar parser consists of 85 functions.
The ABNF grammar of ABNF is mostly LL(1), with three LL(2) rules, two LL(*) rules, and one (non-critically) ambiguous rule. The parser is implemented as recursive descent with backtracking, using the Seq macros from the Community Books. The parser correctness proof consists of soundness and completeness. Soundness: if the parser succeeds, the output parse tree matches rulelist and its tree->string is the input string. Completeness: running the parser on the tree->string of a parse tree that matches rulelist and that (necessarily) satisfies certain disambiguating restrictions, succeeds and yields that parse tree. move ABNF grammar parser to next slide The correctness proof consists of 424 theorems, organized into several inter-dependent categories. Completeness is much more laborious to prove than soundness. These proof techniques should be more generally applicable.

214 The verified ABNF grammar parser consists of 85 functions.

215 ABNF grammar parser

216 The ABNF grammar parser can be run on the ABNF grammar of ABNF.

217 parse-grammar-from-file
The ABNF grammar parser can be run on the ABNF grammar of ABNF. The ABNF grammar parser can be run on the ABNF grammar of ABNF. *http-grammar* copy & paste rulelist ... abstract-rulelist parse-grammar-from-file HTTP RFC

218 parse-grammar-from-file
The ABNF grammar parser can be run on the ABNF grammar of ABNF. The ABNF grammar parser can be run on the ABNF grammar of ABNF. HTTP RFC rulelist ... *http-grammar* copy & paste parse-grammar-from-file abstract-rulelist

219 parse-grammar-from-file
The ABNF grammar parser can be run on the ABNF grammar of ABNF. The ABNF grammar parser can be run on the ABNF grammar of ABNF. ABNFRFCs rulelist ... *abnf-grammar* copy & paste parse-grammar-from-file abstract-rulelist

220 The ABNF grammar parser can be run on the ABNF grammar of ABNF.
trascription in the formalization of the ABNF concrete syntax rulelist ... *abnf-grammar* copy & paste parse-grammar-from-file abstract-rulelist

221 The ABNF grammar parser can be run on the ABNF grammar of ABNF.
trascription in the formalization of the ABNF concrete syntax formalization ABNF concrete syntax rulelist ... *abnf-grammar* copy & paste parse-grammar-from-file abstract-rulelist

222 The ABNF grammar parser can be run on the ABNF grammar of ABNF.
This provides a validation of the ABNF concrete syntax formalization. trascription in the formalization of the ABNF concrete syntax rulelist ... *abnf-grammar* copy & paste parse-grammar-from-file abstract-rulelist

223 The ABNF grammar parser can be run on the ABNF grammar of ABNF.
This provides a validation of the ABNF concrete syntax formalization. trascription in the formalization of the ABNF concrete syntax rulelist ... *abnf-grammar* copy & paste parse-grammar-from-file abstract-rulelist

224 For more information: “ABNF in ACL2”, Technical Report (

225 For more information: “ABNF in ACL2”, Technical Report (

226 For more information:

227 For more information:

228 For much more information:

229 For much more information:
‘ABNF’ topic in the ACL2+Books manual


Download ppt "ABNF in ACL2 Alessandro Coglio Kestrel Institute Workshop 2017."

Similar presentations


Ads by Google