Commit Graph

257 Commits (170824be613b359935d0d901aeb4f64590aad5e9)

Author SHA1 Message Date
Tristan B. V. Kildaire 9f6dd813c8 Added support for class inheritance parsing 2021-03-21 09:45:40 +02:00
Tristan B. Kildaire ceffcd7b9c Clean up 2021-03-20 21:26:42 +02:00
Tristan B. V. Kildaire bf1f6fafa7 Removed uneeded stuff 2021-03-20 21:47:35 +02:00
Tristan B. V. Kildaire 43050f9d3f Cleaned up 2021-03-20 18:50:48 +02:00
Tristan B. V. Kildaire a911141da9 Added new test case for if-statement parsing to test lone else's and else if's 2021-03-20 18:43:22 +02:00
Tristan B. V. Kildaire eaf359ec2d Updated test case 2021-03-20 18:42:16 +02:00
Tristan B. V. Kildaire 88a5528070 Updated test cases for testing if-statement parsing 2021-03-20 18:41:35 +02:00
Tristan B. V. Kildaire 35132be9d6 If statement parsing completed
Also on unknown symbol in `parseBody` remember to error out and exit
2021-03-20 18:41:26 +02:00
Tristan B. V. Kildaire 70bdeed89b WIP: If statement parsing seems to work and pick up some errors 2021-03-20 18:38:16 +02:00
Tristan B. V. Kildaire bbe52bb287 Exit after else 2021-03-20 18:36:25 +02:00
Tristan B. V. Kildaire 6edae88d76 We would never not start on an if, hence said variable would always be true 2021-03-20 18:31:20 +02:00
Tristan B. V. Kildaire 2873a6ab4e Cleaned up 2021-03-20 18:31:03 +02:00
Tristan B. V. Kildaire 1121f2d84e Updated test case 2021-03-20 15:25:48 +02:00
Tristan B. V. Kildaire 0ccadf51d4 Updated test case 2021-03-20 15:24:44 +02:00
Tristan B. V. Kildaire 5874a4c801 Fixed if statement parsing bug 2021-03-20 15:24:39 +02:00
Tristan B. Kildaire 7882b49c72 Removed redundancy 2021-03-18 21:06:18 +02:00
Tristan B. Kildaire 808c124724 WIP: If statements
Something is consuming too much if statement wise (only when `else` is present though)
2021-03-18 21:06:10 +02:00
Tristan B. Kildaire 4322c2aa0c WIP: If statement with else if's and else 2021-03-18 19:20:17 +02:00
Tristan B. V. Kildaire 9c22731098 Bruh 2021-03-17 22:25:07 +02:00
Tristan B. Kildaire b84ee81e7b Revert 2021-03-17 10:33:22 +02:00
Tristan B. Kildaire 9763a85478 Expect now throws an exception 2021-03-17 10:05:56 +02:00
Tristan B. V. Kildaire 034129162f Updated test case 2021-03-16 13:34:11 +02:00
Tristan B. Kildaire 81a4c0537b Multiple function declarations can now be parsed, previous error was due to exiting only when we were out of tokens, now we exit after consuming `}` after the call to parseBody() 2021-03-16 10:57:04 +02:00
Tristan B. Kildaire 0ea5b78a2f Bruh 2021-03-16 10:36:50 +02:00
Tristan B. Kildaire b6467583a1 Updated test case 2021-03-16 10:36:45 +02:00
Tristan B. V. Kildaire d89e999958 Cleaned up 2021-03-16 07:30:18 +02:00
Tristan B. Kildaire 18a5bdca16 Added recursive brace parsing for parseExpression()
Updated test case to test it
2021-03-15 11:29:05 +02:00
Tristan B. Kildaire e5b86498f5 Added TODO about parseExpression for recursive () parsing 2021-03-15 10:50:06 +02:00
Tristan B. Kildaire b7f77b8619 parseExpression fixed for termination
Updated test cases to test this
2021-03-15 10:46:00 +02:00
Tristan B. V. Kildaire 0cc1b2e4ea Added TODO 2021-03-05 12:56:36 +02:00
Tristan B. V. Kildaire 6267ba1505 Added more enter/leave debug messages 2021-03-05 12:35:58 +02:00
Tristan B. V. Kildaire 2b7dd2fce3 Added unittest for identifiers 2021-03-05 12:12:05 +02:00
Tristan B. V. Kildaire bfdbaaeee7 Replaced old expect messages with new `expect(string)` 2021-03-05 12:03:31 +02:00
Tristan B. V. Kildaire 4ed0b385cf Added new `expect(string)` method for custom messages for panic
Also made `expect(SymbolType, Token)` use said new method
2021-03-05 12:01:57 +02:00
Tristan B. V. Kildaire 88a5c0e482 Added enter and leave debug prints to `parseBody()` 2021-03-05 12:00:13 +02:00
Tristan B. V. Kildaire 2cdc53e9b6 Cleaned up debug prints for `parseIf` and `parseWhile` 2021-03-05 11:58:51 +02:00
Tristan B. V. Kildaire f547a1127d Added TODO for `parseExpression` - found possible way to implement expression parsing correctly 2021-03-05 11:46:51 +02:00
Tristan B. V. Kildaire 94f15af031 Made token movement for `parseIf` and `parseWhile` self-contained 2021-03-05 11:40:06 +02:00
Tristan B. V. Kildaire 847f76d7d2 Cleaned up `parseClass` 2021-03-05 11:38:00 +02:00
Tristan B. V. Kildaire f36ab8df5f Updated test case by adding more recursive tests 2021-03-05 11:33:26 +02:00
Tristan B. V. Kildaire 3437d6ca84 Updated test case 2021-03-05 11:31:52 +02:00
Tristan B. V. Kildaire a502cad168 Allowed `paraeBody()` to parse classes by making a class to `parseClass` o occurence of `class` keyword
Updated test case to test this
2021-03-05 11:31:33 +02:00
Tristan B. V. Kildaire 60516134ff Allow identifiers to contain numbers and underscores, however numbers may not be the first character of the identifier
Updated test cases to test this
2021-03-05 11:27:58 +02:00
Tristan B. V. Kildaire b0f0aa9361 Updated test case 2021-03-05 11:21:16 +02:00
Tristan B. V. Kildaire f62c2bbc02 Added class parsing to `parse()` and updated test case to test it 2021-03-05 11:21:06 +02:00
Tristan B. V. Kildaire 5c37112f42 Added more keywords 2021-03-05 10:30:27 +02:00
Tristan B. V. Kildaire a223045bb3 Added a few more keywords for future functionality 2021-03-04 23:54:46 +02:00
Tristan B. V. Kildaire 28c7bc4d3e Added new splitter 2021-03-04 23:25:24 +02:00
Tristan B. V. Kildaire a493ecc2a9 Added `parseClass()` function, `class` keyword support - for future class support 2021-03-04 23:25:20 +02:00
Tristan B. V. Kildaire 14aafe7097 Added some notes on refactoring the statement parsing system 2021-03-03 23:10:21 +02:00
Tristan B. V. Kildaire ffa94ba6e5 Added TODO 2021-03-03 21:38:53 +02:00
Tristan B. V. Kildaire f679a6dd83 Added support for while loops 2021-03-03 20:50:06 +02:00
Tristan B. V. Kildaire 302017e051 Added comment 2021-03-03 20:16:56 +02:00
Tristan B. V. Kildaire 1c335db683 Fixed bug that would allow you to not have a closing } for a body if you ran out of tokens.
It was checked by other means but not for `parse` me thinks
2021-03-03 20:04:54 +02:00
Tristan B. V. Kildaire ec8b03b4b6 Changed some stuff up, found bug that needs to be sorted out 2021-03-03 19:53:47 +02:00
Tristan B. V. Kildaire 25910b4940 Updated test case to include two function calls 2021-03-03 18:35:05 +02:00
Tristan B. V. Kildaire 0abfbf0b9e Function calls implemented 2021-03-03 18:34:38 +02:00
Tristan B. V. Kildaire da79f7f1d5 Updated test cases
Added string literal support for expressions
2021-03-03 18:18:08 +02:00
Tristan B. V. Kildaire 7a2ee46cdb Added new test cases 2021-03-03 18:09:58 +02:00
Tristan B. V. Kildaire bd656b9809 Updated test case 2021-03-03 17:44:16 +02:00
Tristan B. V. Kildaire 9b3440190b Recursive if statement parsing works! 2021-03-03 17:35:48 +02:00
Tristan B. V. Kildaire 8f746c97d0 Recursive expression handling 2021-03-03 17:28:39 +02:00
Tristan B. V. Kildaire 3ffa81d75f Call `nextToken` from within `parseExpression` to know when to quit, therefore removed calls made to nextToken after the call to `parseExpression` 2021-03-03 17:18:19 +02:00
Tristan B. V. Kildaire 5f4e46120b Moved symbol recognition unittests from parser.d to symbols.d 2021-03-03 17:12:06 +02:00
Tristan B. V. Kildaire e30291a5a0 Fixed unittests in parser 2021-03-03 17:09:08 +02:00
Tristan B. V. Kildaire f9b68b9658 Migrated symbol code from parser.d to symbols.d 2021-03-03 16:52:35 +02:00
Tristan B. V. Kildaire 89b52ec81e Added support for multiple function parameters in a function declaration 2021-03-03 16:46:13 +02:00
Tristan B. V. Kildaire 162b94447c Added body parsing for functions 2021-03-03 16:30:56 +02:00
Tristan B. V. Kildaire 6ef78bdb3b WIP: Function parsing 2021-03-03 16:05:45 +02:00
Tristan B. V. Kildaire eee13e915b Added invalid test cases 2021-03-03 15:33:22 +02:00
Tristan B. V. Kildaire aa8c23b4c7 Error out on invalid form for `parseTypedDeclaration` 2021-03-03 15:32:28 +02:00
Tristan B. V. Kildaire eca6acf4bf WIP: Variable declarations with/without assignments 2021-03-03 15:17:51 +02:00
Tristan B. V. Kildaire 84d190f78e WIP: Variable declaration parsing 2021-03-03 14:42:57 +02:00
Tristan B. V. Kildaire 9b45df01a6 Updated test case 2021-03-03 14:05:28 +02:00
Tristan B. V. Kildaire 162dd2d7e5 Added more symbols 2021-03-03 14:05:26 +02:00
Tristan B. V. Kildaire 3c21a5ad3f Set expectation error printout to error 2021-03-03 14:05:20 +02:00
Tristan B. V. Kildaire d87bbc0061 Fixed bug whereby the current token would never increment 2021-03-03 14:04:26 +02:00
Tristan B. V. Kildaire f2b1956555 Added needed plumbing for parser 2021-03-03 13:30:56 +02:00
Tristan B. V. Kildaire 484353f6a9 Adjusted column number to be a little closer to home (might change later when I try to make column numbers more accurate) 2021-03-03 13:30:41 +02:00
Tristan B. V. Kildaire 49d0fc0086 Fixed column number tracking 2021-03-03 13:14:41 +02:00
Tristan B. V. Kildaire 85efca8b87 Compiler now reads source file 2021-03-03 13:14:28 +02:00
Tristan B. V. Kildaire e5cb256e8a Added test case 2021-03-03 13:14:17 +02:00
Tristan B. V. Kildaire c439b4792c Integrated new Token type with lexer, now tokens take with them their line number and column number 2021-03-03 12:11:57 +02:00
Tristan B. V. Kildaire ef554befa4 Refactored lexer state variables to instance fields rather than local variables 2021-03-03 11:45:23 +02:00
Tristan B. V. Kildaire 8d24f6ada2 Added new-line support
Also added tracking for line number
2021-03-03 11:41:16 +02:00
Tristan B. V. Kildaire 45e707b582 Added skeleton parser module 2021-03-03 11:08:34 +02:00
Tristan B. V. Kildaire 2ceaa0c8b0 Added Token class for future use in lexer 2021-03-03 11:05:57 +02:00
Tristan B. V. Kildaire 1c2684814f Added TODO to do more tests 2021-03-03 11:02:03 +02:00
Tristan B. V. Kildaire 0f8862aedf Corrected module placement 2021-03-03 10:54:30 +02:00
Tristan B. V. Kildaire 508885377f Removed TODO 2021-03-03 00:58:40 +02:00
Tristan B. V. Kildaire 02ed1f5af4 Addec character literal support 2021-03-03 00:37:52 +02:00
Tristan B. V. Kildaire a5b9837c80 Added escape sequence support 2021-03-03 00:11:16 +02:00
Tristan B. V. Kildaire 6c529fb67b Added more splitter characters 2021-03-02 23:36:53 +02:00
Tristan B. V. Kildaire 68f9bb6523 Fixed bug (and added corresponding unit test) whereby the combinator check would fail if the first element was at end-of-source 2021-03-02 23:29:19 +02:00
Tristan B. V. Kildaire 28ab54e852 Added more uni tests 2021-03-02 23:27:32 +02:00
Tristan B. V. Kildaire a7c0d37a01 Removed testing code 2021-03-02 23:22:46 +02:00
Tristan B. V. Kildaire f23d884b90 Fixed bug where we overshot array and added unittests 2021-03-02 23:22:42 +02:00
Tristan B. V. Kildaire 1b0de5776b Fixed bug whereby any splitter would result in the addition of the semi-colon, regardless of the splitter character 2021-03-02 22:44:24 +02:00
Tristan B. V. Kildaire acab7dd5f3 Support for several splitter characters added 2021-03-02 22:43:09 +02:00
Tristan B. V. Kildaire ce7ea36b0b Only flush the currentToken when encountering a semi-colon IF the currentToken is non-empty 2021-03-02 22:33:38 +02:00
Tristan B. V. Kildaire b178528ece Only flush token if there is one leftover 2021-03-02 22:31:53 +02:00
Tristan B. V. Kildaire cce91b6615 Added support for semi-colon delimiting 2021-03-02 22:31:18 +02:00
Tristan B. V. Kildaire 1f103bf190 Basic lexer added
Supports splitting by whitespace
Supports escaping into string mode and returning back to whitespace splitting mode
2021-03-02 22:26:35 +02:00
Tristan B. V. Kildaire 7a2b73a299 Call compilation entry point 2021-03-02 21:55:45 +02:00
Tristan B. V. Kildaire 639455d792 Added basic command-line arguments parsing 2021-03-02 21:51:49 +02:00
Tristan B. V. Kildaire 505764b8bb Added directory structure 2021-03-02 21:14:23 +02:00
Tristan B. V. Kildaire 0c6311b3eb Initial commit 2021-03-02 21:03:55 +02:00