• entries
    359
  • comments
    237
  • views
    188441

Language Genesis: Part 1 - Parsing.

Sign in to follow this  
Telastyn

55 views

The final 4 pages or so of BNF got coded over the weekend. Clocks in at around 1750 lines excluding library code. A nice 2 hours worth of simple bugfixing, then another hour fixing the BNF.

(for those curious, there needs to be special care taken with Array Types, Nullable Types and Namespace or TypeName entries so that they don't infinitely loop. You can't just parse their entries individually, you need to look for the rank specifiers, ?, and . respectively and shortcut things if they're not there)

I'm sure there's tons more little gotchas or things I typo'd. I'll fix/clean these as I need or come across them, but this should be good enough to begin on the simple extension. First on the chart is replacing is/as/(cast) with ducktyping equivalents.

And tonight's 'screenshot':

Parsing target:

class foo{}


Resultant un-pruned tree:

CompilationUnit 0:4 - class foo {}
rms.Support.Parsing.Token.Sequence 0:4 - class foo {}
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:4 - class foo {}
TypeDeclaration 0:4 - class foo {}
ClassDeclaration 0:4 - class foo {}
rms.Support.Parsing.Token.Sequence 0:4 - class foo {}
rms.Support.Parsing.Token.Sequence 0:4 - 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: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 -
rms.Support.Parsing.Token.Series 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:4 - {}
rms.Support.Parsing.Token.Sequence 2:4 - {}
rms.Support.Parsing.Token.Sequence 2:3 - {
rms.Support.Parsing.Token.LiteralTokenParser 2:3 - {
rms.Support.Parsing.Token.Series 3:3 -
rms.Support.Parsing.Token.LiteralTokenParser 3:4 - }
rms.Support.Parsing.Token.LiteralTokenParser 4:4 -

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now