Skip to content

Commit 3eb6d0e

Browse files
committed
Organizing files related to acme
1 parent 4b957e5 commit 3eb6d0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+359
-9854
lines changed

grammars/acme/acme-auto-generated-manual.lua

-298
This file was deleted.

grammars/acme/acme-auto-generated-manual2.lua

-298
This file was deleted.

grammars/acme/acme-auto-generated-manual3.lua

-298
This file was deleted.

grammars/acme/acme-auto-generated.lua

-299
This file was deleted.

grammars/acme/artigoJSS-auto-manual.lua renamed to grammars/acme/acme-auto-manual.lua

+7-13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ local Util = require'pegparser.util'
44
local Cfg2Peg = require'pegparser.cfg2peg'
55
local Coder = require'pegparser.coder'
66

7+
-- grammar generated by pegparser
8+
-- Edited to fix the longest matching issue involving rules INTEGER_LITERAL and FLOATING_POINT_LITERAL
79
local s = [===[
810
acmeCompUnit <- acmeImportDeclaration* (acmeSystemDeclaration / acmeFamilyDeclaration / acmeDesignDeclaration)+ EOF
911
acmeImportDeclaration <- IMPORT (filename / stringLiteral) SEMICOLON
@@ -167,7 +169,7 @@ LBRACKET <- '['
167169
RBRACKET <- ']'
168170
LPAREN <- '('
169171
RPAREN <- ')'
170-
LANGLE <- !IFF !PROPBEGIN !LE '<'
172+
LANGLE <- !PROPBEGIN !IFF !LE '<'
171173
RANGLE <- !GE !PROPEND '>'
172174
LE <- '<='
173175
NE <- '!='
@@ -239,7 +241,6 @@ Y <- 'y' / 'Y'
239241
Z <- 'z' / 'Z'
240242
BOOLEAN <- TRUE / FALSE
241243
FLOATING_POINT_LITERAL <- ('-' / '+')? [0-9]+ '.' [0-9]+
242-
--INTEGER_LITERAL <- [0-9]+
243244
INTEGER_LITERAL <- !FLOATING_POINT_LITERAL [0-9]+
244245
STRING_LITERAL <- '"' (!'"' .)* '"'
245246
IDENTIFIER <- !__Keywords [a-zA-Z] [a-zA-Z0-9_-]*
@@ -272,23 +273,16 @@ __rep_013 <- SEMICOLON literalRecordEntry __rep_013 / &(RBRACKET / SE
272273
__IdBegin <- [a-zA-Z]
273274
__IdRest <- [a-zA-Z0-9_-]
274275
__Keywords <- ABSTRACT / ANALYSIS / AND / ANY / ATTACHEDPORTS / ATTACHEDROLES / ATTACHMENT / ATTACHMENTS / BINDINGS / COLLECT / COMPONENT / COMPONENTS / CONNECTOR / CONNECTORS / CONTAINASSIGN / DESIGN / DISTINCT / DOUBLE / ELEMENT / ENUM / EXISTS / EXTENDED / EXTENDS / EXTERNAL / FALSE / FAMILY / FINAL / FLOAT / FORALL / GROUP / GROUPS / HEURISTIC / IMPORT / IN / INT / INVARIANT / MEMBERS / NEW / OR / PORT / PORTS / POWER / PRIVATE / PROPERTIES / PROPERTY / PUBLIC / RECORD / REPRESENTATION / REPRESENTATIONS / ROLE / ROLES / RULE / SELECT / SEQUENCE / SET / STRING / STYLE / SYSTEM / TO / TRUE / TYPE / UNIQUE / VIEW / WITH
275-
276276
]===]
277277

278-
local g = Parser.match(s)
279-
assert(g)
278+
local peg = Parser.match(s)
279+
assert(peg)
280280
pretty = Pretty.new()
281-
print(pretty:printg(g, nil, true))
282-
--local c2p = Cfg2Peg.new(g)
283-
--c2p:setUseUnique(false)
284-
--c2p:setUsePrefix(false)
285-
--c2p:convert('IDENTIFIER', true)
286-
local peg = g--c2p.peg
287-
--print(pretty:printg(peg, nil, true))
281+
print(pretty:printg(peg, nil, true))
288282

289283
local p = Coder.makeg(peg)
290284
local dir = Util.getPath(arg[0])
291-
Util.testYes(dir .. '/examples/cmu/', 'acmetest', p)
285+
Util.testYes(dir .. '/examples/', 'acmetest', p)
292286
Util.testYes(dir .. '/grammarinator/tests_01/', 'acmetest', p)
293287
Util.testYes(dir .. '/grammarinator/tests_02/', 'acmetest', p)
294288
Util.testYes(dir .. '/grammarinator/tests_03/', 'acmetest', p)

grammars/acme/acme-auto.lua

+274-249
Large diffs are not rendered by default.

grammars/acme/acme-cfg2peg.lua

-281
This file was deleted.

grammars/acme/acme-manual.lua

-269
This file was deleted.

grammars/acme/acme.lua

+52-47
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
local m = require 'pegparser.parser'
2-
local pretty = require 'pegparser.pretty'
3-
local coder = require 'pegparser.coder'
4-
local recovery = require 'pegparser.recovery'
5-
local ast = require'pegparser.ast'
6-
local util = require'pegparser.util'
7-
local first = require'pegparser.first'
8-
local cfg2peg = require'pegparser.cfg2peg'
1+
local Parser = require 'pegparser.parser'
2+
local Pretty = require 'pegparser.pretty'
3+
local Util = require'pegparser.util'
4+
local Cfg2Peg = require'pegparser.cfg2peg'
5+
local Coder = require'pegparser.coder'
96

107
local s = [===[
11-
acmeCompUnit <- (acmeImportDeclaration )* (acmeSystemDeclaration / acmeFamilyDeclaration / acmeDesignDeclaration )+
8+
acmeCompUnit <- (acmeImportDeclaration )* (acmeSystemDeclaration / acmeFamilyDeclaration / acmeDesignDeclaration )+ EOF
129
acmeImportDeclaration <- IMPORT (filename / stringLiteral ) SEMICOLON
1310
stringLiteral <- STRING_LITERAL
1411
filename <- ('$' / '%' )? IDENTIFIER ((('.' / ':' / '-' / '+' / '\\' / '\\\\' / '/' / '$' / '%' ) )+ IDENTIFIER )*
@@ -214,32 +211,32 @@ VIEW <- V I E W
214211
BIT_OR <- '|'
215212
TRUE <- T R U E
216213
FALSE <- F A L S E
217-
A <- ('a' / 'A')
218-
B <- ('b' / 'B')
219-
C <- ('c' / 'C')
220-
D <- ('d' / 'D')
221-
E <- ('e' / 'E')
222-
F <- ('f' / 'F')
223-
G <- ('g' / 'G')
224-
H <- ('h' / 'H')
225-
I <- ('i' / 'I')
226-
J <- ('j' / 'J')
227-
K <- ('k' / 'K')
228-
L <- ('l' / 'L')
229-
M <- ('m' / 'M')
230-
N <- ('n' / 'N')
231-
O <- ('o' / 'O')
232-
P <- ('p' / 'P')
233-
Q <- ('q' / 'Q')
234-
R <- ('r' / 'R')
235-
S <- ('s' / 'S')
236-
T <- ('t' / 'T')
237-
U <- ('u' / 'U')
238-
V <- ('v' / 'V')
239-
W <- ('w' / 'W')
240-
X <- ('x' / 'X')
241-
Y <- ('y' / 'Y')
242-
Z <- ('z' / 'Z')
214+
fragment A <- ('a' / 'A')
215+
fragment B <- ('b' / 'B')
216+
fragment C <- ('c' / 'C')
217+
fragment D <- ('d' / 'D')
218+
fragment E <- ('e' / 'E')
219+
fragment F <- ('f' / 'F')
220+
fragment G <- ('g' / 'G')
221+
fragment H <- ('h' / 'H')
222+
fragment I <- ('i' / 'I')
223+
fragment J <- ('j' / 'J')
224+
fragment K <- ('k' / 'K')
225+
fragment L <- ('l' / 'L')
226+
fragment M <- ('m' / 'M')
227+
fragment N <- ('n' / 'N')
228+
fragment O <- ('o' / 'O')
229+
fragment P <- ('p' / 'P')
230+
fragment Q <- ('q' / 'Q')
231+
fragment R <- ('r' / 'R')
232+
fragment S <- ('s' / 'S')
233+
fragment T <- ('t' / 'T')
234+
fragment U <- ('u' / 'U')
235+
fragment V <- ('v' / 'V')
236+
fragment W <- ('w' / 'W')
237+
fragment X <- ('x' / 'X')
238+
fragment Y <- ('y' / 'Y')
239+
fragment Z <- ('z' / 'Z')
243240
BOOLEAN <- TRUE / FALSE
244241
FLOATING_POINT_LITERAL <- ('-' / '+')? [0-9]+ '.' [0-9]+
245242
INTEGER_LITERAL <- [0-9]+
@@ -250,16 +247,24 @@ BLOCK_COMMENT <- '/*' .*? '*/'
250247
WS <- [ \r\n\t]+
251248
]===]
252249

253-
g = m.match(s)
254-
print(m.match(s))
255-
print(pretty.printg(g, true), '\n')
256-
first.calcFst(g)
257-
first.calcFlw(g)
258-
first.getChoiceReport(g)
259-
first.getRepReport(g)
260-
local p = coder.makeg(g, 'ast')
261-
local peg = cfg2peg.convert(g, 'IDENTIFIER')
262-
print(pretty.printg(peg, true), '\n')
263-
local dir = util.getPath(arg[0])
264-
util.testYes(dir .. '/yes/', 'acmetest', p)
250+
local g = Parser.match(s)
251+
assert(g)
252+
pretty = Pretty.new()
253+
print(pretty:printg(g, nil, true))
254+
local c2p = Cfg2Peg.new(g)
255+
c2p:setUseUnique(false)
256+
c2p:setUsePrefix(true)
257+
c2p:convert('IDENTIFIER', true)
258+
local peg = c2p.peg
259+
print(pretty:printg(peg, nil, true))
260+
261+
local p = Coder.makeg(peg)
262+
local dir = Util.getPath(arg[0])
263+
Util.testYes(dir .. '/examples/', 'acmetest', p)
264+
Util.testYes(dir .. '/grammarinator/tests_01/', 'acmetest', p)
265+
Util.testYes(dir .. '/grammarinator/tests_02/', 'acmetest', p)
266+
Util.testYes(dir .. '/grammarinator/tests_03/', 'acmetest', p)
267+
Util.testYes(dir .. '/grammarinator/tests_04/', 'acmetest', p)
268+
Util.testYes(dir .. '/outputNoTk/yes/', 'acmetest', p)
269+
Util.testNo(dir .. '/outputNoTk/no/', 'acmetest', p)
265270

0 commit comments

Comments
 (0)