Scope work progressing. Gotta fix bugs. Good save spot.
This commit is contained in:
@@ -2,7 +2,7 @@ Goal = translation_unit ;
|
||||
translation_unit = interpreter_directive WS unorderd_list_part WS ;
|
||||
unorderd_list_part = import WS unorderd_list_part | function WS unorderd_list_part | type_def WS ";" WS unorderd_list_part | if_comp WS unorderd_list_part | simple_passthrough WS unorderd_list_part | declaration_statement WS ";" WS unorderd_list_part | import | function | type_def WS ";" | if_comp | simple_passthrough | declaration_statement WS ";" ;
|
||||
|
||||
type = type WS "\*" | "void" | "int" | "float" | "double" | "char" | identifier | identifier WS template_inst ;
|
||||
type = type WS "\*" | "void" | "int" | "float" | "double" | "char" | scoped_identifier | scoped_identifier WS template_inst ;
|
||||
dec_type = "\|" WS type WS "\|" ;
|
||||
|
||||
template_inst = "<" WS type_list WS ">" ;
|
||||
@@ -12,8 +12,8 @@ template_dec = "template" WS "<" WS template_param_list WS ">" ;
|
||||
template_param_list = template_param_list WS "," WS template_param | template_param ;
|
||||
template_param = identifier WS traits | identifier ;
|
||||
|
||||
import = "import" WS identifier WS ";" ;
|
||||
|
||||
import = "import" WS identifier WS ";" | "import" WS identifier WS ":" WS "\*" WS ";" | "import" WS identifier WS ":" WS import_list WS ";" ;
|
||||
import_list = identifier | identifier WS "," WS import_list ;
|
||||
|
||||
interpreter_directive = "#!" WS path | ;
|
||||
path = path path_part | path_part ;
|
||||
@@ -37,6 +37,7 @@ triple_quoted_string = "\"\"\"((\"\"(`|1|2|3|4|5|6|7|8|9|0|-|=| |q|w|e|r|t|y|u|i
|
||||
|z|x|c|v|b|n|m|,|.|/|~|!|@|#|$|%|^|&|\*|\(|\)|_|\+|Q|W|E|R|T|Y|U|I|O|P|{|}|\||A|S|D|F|G|H|J|K|L|:|Z|X|C|V|B|N|M|<|>|\?| )+))*\"\"\"" ;
|
||||
|
||||
identifier = alpha | alpha alphanumeric ;
|
||||
scoped_identifier = scoped_identifier WS "::" WS identifier | identifier ;
|
||||
|
||||
#Note that to prevent confilct with nested templates (T<A<B>>) it is a nonterminal contructed as follows
|
||||
right_shift = ">" ">" ;
|
||||
@@ -56,7 +57,7 @@ type_def = "typedef" WS identifier WS type | "typedef" WS template_dec WS identi
|
||||
|
||||
declaration_block = declaration_statement WS ";" WS declaration_block | function WS declaration_block | declaration_statement WS ";" | function | ;
|
||||
traits = "\(" WS trait_list WS "\)" ;
|
||||
trait_list = trait_list WS "," WS identifier | identifier ;
|
||||
trait_list = trait_list WS "," WS scoped_identifier | scoped_identifier ;
|
||||
|
||||
#Older rule for stuff with visibility labels - this should be added sometime
|
||||
#type_def = "typedef" WS identifier WS type | "typedef" WS template_dec WS identifier WS "{" WS class_innerds WS "}" | "typedef" WS identifier WS "{" WS class_innerds WS "}" | "typedef" WS template_dec WS identifier WS "{" WS declaration_block WS "}" | "typedef" WS identifier WS "{" WS declaration_block WS "}" ;
|
||||
@@ -87,7 +88,7 @@ expression = expression WS "<<" WS term | expression WS right_shift WS shiftand
|
||||
shiftand = shiftand WS "-" WS term | shiftand WS "\+" WS term | term ;
|
||||
term = term WS forward_slash WS factor | term WS "\*" WS factor | term WS "%" WS factor | factor ;
|
||||
factor = "\+\+" WS unarad | unarad WS "\+\+" | "--" WS unarad | unarad WS "--" | "\+" WS unarad | "-" WS unarad | "!" WS unarad | "~" WS unarad | "\(" WS type WS "\)" WS unarad | "\*" WS unarad | "&" WS unarad | unarad ;
|
||||
unarad = number | identifier | identifier WS template_inst | function_call | bool | string | character | "\(" WS boolean_expression WS "\)" | access_operation | unarad WS "[" WS expression WS "]" ;
|
||||
unarad = number | scoped_identifier | scoped_identifier WS template_inst | function_call | bool | string | character | "\(" WS boolean_expression WS "\)" | access_operation | unarad WS "[" WS expression WS "]" ;
|
||||
number = integer | floating_literal ;
|
||||
access_operation = unarad "." identifier | unarad "->" identifier ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user