Skip to content

Commit

Permalink
Develop rust-build: basic viability established
Browse files Browse the repository at this point in the history
  • Loading branch information
acweathersby committed Dec 25, 2023
1 parent 37058fc commit 12ec134
Show file tree
Hide file tree
Showing 40 changed files with 6,508 additions and 6,188 deletions.
27 changes: 14 additions & 13 deletions src/grammar/radlr/2.0.0/ascript.sg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ IMPORT ./token as token

<> body >

structprop
struct_prop

| add

| map
Expand Down Expand Up @@ -71,41 +72,41 @@ IMPORT ./token as token

<> numeric_convert >

"u8" convert_initializer?
"u8" numeric_initializer?
:ast { t_AST_U8, initializer: $2, tok }

| "u16" convert_initializer?
| "u16" numeric_initializer?
:ast { t_AST_U16, initializer: $2, tok }

| "u32" convert_initializer?
| "u32" numeric_initializer?
:ast { t_AST_U32, initializer: $2, tok }

| "u64" convert_initializer?
| "u64" numeric_initializer?
:ast { t_AST_U64, initializer: $2, tok }

| "i8" convert_initializer?
| "i8" numeric_initializer?
:ast { t_AST_I8, initializer: $2, tok }

| "i16" convert_initializer?
| "i16" numeric_initializer?
:ast { t_AST_I16, initializer: $2, tok }

| "i32" convert_initializer?
| "i32" numeric_initializer?
:ast { t_AST_I32, initializer: $2, tok }

| "i64" convert_initializer?
| "i64" numeric_initializer?
:ast { t_AST_I64, initializer: $2, tok }

| "f32" convert_initializer?
| "f32" numeric_initializer?
:ast { t_AST_F32, initializer: $2, tok }

| "f64" convert_initializer?
| "f64" numeric_initializer?
:ast { t_AST_F64, initializer: $2, tok }

<> numeric_initializer >

| convert_initializer
convert_initializer |

'(' token::int ")"
'(' token::num ")"
:ast { t_NumInit, expression: { t_AST_NUMBER, value:f64($2) } }

<> convert_initializer >
Expand Down
3 changes: 2 additions & 1 deletion src/grammar/radlr/2.0.0/at_at.sg
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ IGNORE { c:sp c:nl }
| expr "/"{2} expr{2} :ast { t_Div, l:$1, r:$3, tok }
| num
| object
| call
| at_string_literal
| plain_string_literal

Expand Down Expand Up @@ -125,7 +126,7 @@ IGNORE { c:sp c:nl }
| tk:( '.' "#type") :ast { t_Type, tok }
| tk:( '.' "#keys") :ast { t_Keys, tok }
| tk:( '.' "#len") :ast { t_Length, tok }
| tk:( '.' 'iter') call :ast { t_Iterator, call, tok }
| tk:( '.' 'ite' "r") call :ast { t_Iterator, call, tok }

<> id
> binding_id | non_binding_id
Expand Down
6 changes: 5 additions & 1 deletion src/grammar/radlr/2.0.0/token.sg
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ NAME token

<> int > tk:int_tok

<> num > tk:num_tok

<> id_tok > ( "-" | "_" | c:id ) ( c:id | '_' | '-' | c:num )(*)

<> string_tok > "\"" ( c:id | c:num | c:nl | c:sym | c:sp | escaped )(*) "\""
Expand All @@ -16,4 +18,6 @@ NAME token

<> escaped > "\\"{:9999} ( c:sym | c:num | c:sp | c:id )

<> int_tok > c:num(+)
<> int_tok > c:num(+)

<> num_tok > ( '+' | '-' )? c:num(+) ( '.' c:num(+) )? ( ( 'e' | 'E' ) ( '+' | '-' )? c:num(+) )?
Loading

0 comments on commit 12ec134

Please sign in to comment.