0
的語法我有這個語法對此我無法理解爲如何使一個解析器它:一種新的語言
module = properties fields methods module#3 'end'
properties = list#0 (property add#2)*
property = 'class' 'name' class# ';'
fields = list#0 (field add#2)*
field = type list#0 id add#2 [';'/','] ! (',' id add#2)* ';' field#2
methods = list#0 (method add#2)*
method = (type id/nothing#0 id) ! '(' args ')' follow method#4
args = list#0 (arg add#2 (',' arg add#2)*)?
arg = type id ! arg#2/nothing#0 id ! arg#2
statements = list#0 (statement add#2)*
statement = do/jump/compound/simple
follow = block/jump/compound/simple
jump = break/continue/return
compound = if/while
simple = local/assign
do = 'do' '{' statements '}' do#1
block = '{' statements '}' block#1
break = 'break' ';' break#0
continue = 'continue' ';' continue#0
return = 'return' (exp/nothing#0) ';' return#1
if = 'if' '(' exp ')' follow ('else' follow/nothing#0) if#3
while = 'while' '(' exp ')' follow while#2
local = type id ! init? local#2 ';'
init = 'assign' exp assign#2/'.' id dot#2 '(' exps ')' call#2
assign = id 'assign' ! exp assign#2 ';'
exp = id ('(' exps ')' call#2/'.' id dot#2 '(' exps ')' call#2)?
exps = list#0 (exp add#2 (',' exp add#2)*)?
type = 'name' type#
id = 'name' id#
'.' = 'DOT'
任何人都可以,請讓我理解這個語法。 感謝
你是什麼意思「理解這個語法?」你可以說得更詳細點嗎? – templatetypedef
@templatetypedef好..我無法理解這種語法。特別是前幾行。 – Maverick
那你不明白嗎?你瞭解上下文無關的語法和正則表達式嗎?我們不能幫助你,除非你明確你不明白的東西。 – templatetypedef