Language Genesis: Setback 1 - Premature Exuberance

Published December 29, 2007
Advertisement
So after getting the syntax parsing complete I of course went straight at implementing some features. This had two fairly major problems.

1. The syntax parsing wasn't complete. In retrospect parsing "class foo {}" perhaps should not have been my sole benchmark for completeness... it took another 4 hours or so to get "class foo { int y; }" parsing. Debugging parsers is hard.

(For those interested, the problem involved my uneducatedness biting me in the ass again. I realized that something of the form token: (element|token delimiter element) would require special attention, though I failed to generalize the recursion properly...)

2. I overestimated the gains I would get from compiling something almost C# into C#. Sure, a nice optimizing C# compiler is at hand, and the BNF, and libraries and interoperability... but all the lexing/parsing errors are unavailable to me and will need to be replicated. And if I'm going to do anything remotely interesting I'm going to have to do a lot of the type checking symbol table stuff.


It sure does make me appreciate a little more the complexity of such an endeavor and might make me a little more forgiving of the crappy error messages compilers are often giving me.

More Setbacks to come and maybe some actual progress too one day now that I can keep an eye out for coding while a little too pleased with my progress...

"Screenshot of the Day":

CompilationUnit  0:7 - class foo {int y;}  rms.Support.Parsing.Token.Sequence  0:7 - class foo {int y;}    rms.Support.Parsing.Token.Sequence  0:0 -      rms.Support.Parsing.Token.Sequence  0:0 -        rms.Support.Parsing.Token.Series  0:0 -        rms.Support.Parsing.Token.Series  0:0 -      rms.Support.Parsing.Token.Series  0:0 -    rms.Support.Parsing.Token.Series  0:7 - class foo {int y;}      TypeDeclaration  0:7 - class foo {int y;}        ClassDeclaration  0:7 - class foo {int y;}          rms.Support.Parsing.Token.Sequence  0:7 - class foo {int y;}            rms.Support.Parsing.Token.Sequence  0:7 - class foo {int y;}              rms.Support.Parsing.Token.Sequence  0:2 - class foo                rms.Support.Parsing.Token.Sequence  0:2 - class foo                  rms.Support.Parsing.Token.Sequence  0:2 - class foo                    rms.Support.Parsing.Token.Sequence  0:2 - class foo                      rms.Support.Parsing.Token.Sequence  0:1 - class                        rms.Support.Parsing.Token.Sequence  0:0 -                          rms.Support.Parsing.Token.Sequence  0:0 -                            Attributes  0:0 -                            rms.Support.Parsing.Token.Series  0:0 -                          rms.Support.Parsing.Token.LiteralTokenParser  0:0 -                        ClassKeyword  0:1 - class                          rms.Support.Parsing.Token.LiteralTokenParser  0:1 - class                      Identifier  1:2 - foo                        rms.Support.Parsing.Token.TokenTypeParser  1:2 - foo                    rms.Support.Parsing.Token.LiteralTokenParser  2:2 -                  rms.Support.Parsing.Token.LiteralTokenParser  2:2 -                rms.Support.Parsing.Token.Series  2:2 -              ClassBody  2:7 - {int y;}                rms.Support.Parsing.Token.Sequence  2:7 - {int y;}                  rms.Support.Parsing.Token.Sequence  2:6 - {int y;                    rms.Support.Parsing.Token.LiteralTokenParser  2:3 - {                    rms.Support.Parsing.Token.Series  3:6 - int y;                      ClassMemberDeclaration  3:6 - int y;                        FieldDeclaration  3:6 - int y;                          rms.Support.Parsing.Token.Sequence  3:6 - int y;                            rms.Support.Parsing.Token.Sequence  3:5 - int y                              rms.Support.Parsing.Token.Sequence  3:4 - int                                rms.Support.Parsing.Token.Sequence  3:3 -                                  Attributes  3:3 -                                  rms.Support.Parsing.Token.Series  3:3 -                                Type  3:4 - int                                  ValueType  3:4 - int                                    StructType  3:4 - int                                      SimpleType  3:4 - int                                        NumbericType  3:4 - int                                          IntegralType  3:4 - int                                            rms.Support.Parsing.Token.LiteralTokenParser  3:4 - int                              VariableDeclaratorList  4:5 - y                                rms.Support.Parsing.Token.DelimitedTokenSequence  4:5 - y                                  VariableDeclarator  4:5 - y                                    VariableIdentifier  4:5 - y                                      Identifier  4:5 - y                                        rms.Support.Parsing.Token.TokenTypeParser  4:5 - y                            SemiColon  5:6 - ;                              rms.Support.Parsing.Token.LiteralTokenParser  5:6 - ;                  rms.Support.Parsing.Token.LiteralTokenParser  6:7 - }            SemiColon  7:7 - 
0 likes 1 comments

Comments

s_cloudx
Your screenshot needs more lens flare. :D
December 30, 2007 07:35 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement