ADL AOM

Hi,

I am trying to generate an AOM from a grammar, I used a some open-sourced of stuff from Pieter Bos and Thomas Beale.
I modified the grammar, f.e. to let it generate camelCase, and I need to do more with the grammar, still studying it..

I do it just for fun, that is all.

I wanted you to know, so that there are no future misunderstandings

https://github.com/BertVerhees/adl-aom

best regards
Bert

Bert

things that you might think about that I have not done yet:

  • whether we put error branches in the grammar - I had a lot of these in the old .y grammars. All gone for now.
  • whether to put labels on sub-parts of parser rules - will generally only be determinable by implementers - it’s hard for me to guess where to put these
  • there are still a few outstanding annoyances

If you can document somewhere how to do the CamelCase conversion, I will add it to the comments and/or main ADL spec somewhere (i.e. we don’t want to change the case in the original files, but we do want to make it easy for people wanting CamelCase to do a simple operation to get it, so their code looks normal).

  • thomas

I like to see them, can you post a link? Also here, can you give a list and example what it is you are writing about Please list them, now I am diving into it, I can as well take some time for that. I don’t thing there is something as conditionally parsing, but I can write a small conversion-routine which checks the labels, maybe ANTLR gives to room to execute that. I check that. I can only work some 8 hours a week on this, but in that time I can do that. ANTLR has some not often used options, like adding code literally to the grammar to be copied into parser-result. It is good for me to do that, it gies me valuable experience. Bert

ADL - CADL - typical example of code: - look for ‘labels’ - thomas

Thanks, I come back to this

Bert

Thomas Beale schreef op 2-12-2015 om 9:44:

Hi Thomas,

About the errors.

I was wondering, the parser gives syntax errors very well, but they are not for normal users to understand.

But I understand that you need to handle expected errors in a more semantical way, (if this is English)
Like chapter 9.4 in the book.

Adding an alternative which represents the error?

Example

grammar Simple;

prog:classDef+ ;// match one or more class definitions classDef :'class' ID '{' member+'}' |'class' '{' member+'}' {notifyErrorListeners("missing ID");}
     ;

Bert

yes, this is the kind of thing I was thinking of. In most cases, the error should be a tag from the validity error set.

Looks good, I’ll give it a try tomorrow Bert