|
| 09 Jan 2016 11:58 PM |
this:
// first estrela file!
if (10 * 10 > 20) { if (x == true) {
} if (y == "Hello!") {
} }
parses into this:
typeof = ROOT block = { { typeof = IF block = { { typeof = IF block = { } condition = { { typeof = IDENTIFIER word = x } { typeof = EQUAL_TO } { typeof = IDENTIFIER word = true } } } { typeof = IF block = { } condition = { { typeof = IDENTIFIER word = y } { typeof = EQUAL_TO } { typeof = DOUBLE_QUOTE } { typeof = IDENTIFIER word = Hello } { typeof = } { typeof = DOUBLE_QUOTE } } } } condition = { { typeof = NUMBER word = 10 } { typeof = MULTIPLY } { typeof = NUMBER word = 10 } { typeof = GREATER_THAN } { typeof = NUMBER word = 20 } } } } |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 10 Jan 2016 12:00 AM |
i'm not going to say im a hero
but i hope someone else does |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2016 12:00 AM |
| actually there are a couple issues now that i look at it, but those r cuz i got lazy and didnt completely finish the lexer (the most boring ass thing in the world to make) |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 10 Jan 2016 12:01 AM |
yeah, the lexer is just frustrating
fixing one issue usually messes up like 3 different niche situations, it's infuriating |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2016 12:05 AM |
yeah lol
to match things like + - * / ( etc im using the %p pattern, and that was matching double quotes, which is what screwed up the string
and i also forgot to include true and false so they were matching as identifiers |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2016 12:06 AM |
if anyone cares here it is fixed:
typeof = ROOT block = { { typeof = IF block = { { typeof = IF block = { } condition = { { typeof = IDENTIFIER word = x } { typeof = EQUAL_TO } { typeof = TRUE } } } { typeof = IF block = { } condition = { { typeof = IDENTIFIER word = y } { typeof = EQUAL_TO } { typeof = STRING word = Hello! } } } } condition = { { typeof = NUMBER word = 10 } { typeof = MULTIPLY } { typeof = NUMBER word = 10 } { typeof = GREATER_THAN } { typeof = NUMBER word = 20 } } } } |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Jan 2016 01:30 AM |
implemented defining variables :D
i implemented defining variables:
int x = 50; y := "Hello, world!"; string z = y;
parses to
typeof = ROOT block = { { typeof = ASSIGNMENT expression = { { typeof = IDENTIFIER word = x } { typeof = ASSIGNMENT_WITH_DATATYPE } { typeof = NUMBER word = 50 } } identifier = x datatype = int } { typeof = ASSIGNMENT expression = { { typeof = IDENTIFIER word = y } { typeof = ASSIGNMENT_WITHOUT_DATATYPE } { typeof = STRING word = Hello, world! } } identifier = y datatype = UNKNOWN } { typeof = ASSIGNMENT expression = { { typeof = IDENTIFIER word = z } { typeof = ASSIGNMENT_WITH_DATATYPE } { typeof = IDENTIFIER word = y } } identifier = z datatype = string } } |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2016 01:33 AM |
| oops, the < identifier > < assignment_with/without_datatype > shouldn't be in there under the expression table :L |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Jan 2016 02:20 AM |
shh this is my twitter
and also this factorial function properly parsed :D:D:D:D:D:D
int factorial := (int n) { if (n == 1) { return 1; } return n * factorial(n - 1); }
typeof = ROOT block = { { typeof = FUNCTION num_args = 1 identifier = factorial block = { { typeof = IF condition = { { typeof = IDENTIFIER word = n } { typeof = EQUAL_TO } { typeof = NUMBER word = 1 } } block = { { typeof = RETURN expression = { { typeof = NUMBER word = 1 } } } } } { typeof = RETURN expression = { { typeof = IDENTIFIER word = n } { typeof = MULTIPLY } { typeof = IDENTIFIER word = factorial } { typeof = OPEN_PARENTHESIS } { typeof = IDENTIFIER word = n } { typeof = MINUS } { typeof = NUMBER word = 1 } { typeof = CLOSE_PARENTHESIS } } } } arguments = { { datatype = int identifier = n } } } }
ok im done now |
|
|
| Report Abuse |
|
|
| |
|