antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.24k stars 3.71k forks source link

New Matlab syntax since R2016b #1616

Open apjanke opened 4 years ago

apjanke commented 4 years ago

Recent versions of Matlab have added new syntax.

And it doesn't seem like the current Matlab grammar supports classdef statements at all? They've been around for a while.

Would you like an update the the Matlab grammar to support this stuff? I can make a PR.

And would you like the one matlab.g4 grammar file updated to the latest Matlab version, or a new matlabR2019b.g4 grammar file to go alongside it? Lots of Matlab users are stuck on older versions, so I think it might be useful to maintain multiple versions of the grammar to reflect how it has evolved over time. And some people might be using the Matlab grammar on Octave files; Octave is several versions behind Matlab in syntax. So adding a new matlabR2019b.g4 might be best.

Anybody know what Matlab version the current matlab.g4 grammar is based on?

KvanTTT commented 4 years ago

Would you like an update the the Matlab grammar to support this stuff? I can make a PR.

Sure, you are welcome!

And would you like the one matlab.g4 grammar file updated to the latest Matlab version, or a new matlabR2019b.g4 grammar file to go alongside it?

Is that back-compatible? If so, I recommend updating the old version with the new one to get rid of duplication.

it might be useful to maintain multiple versions of the grammar to reflect how it has evolved over time

Git system control is developed for such purposes. There is no need to keep the old version.

Anybody know what Matlab version the current matlab.g4 grammar is based on?

As I understand from license notice, @teverett is the author of this grammar. Maybe he can answer.

apjanke commented 4 years ago

Is that back-compatible? If so, I recommend updating the old version with the new one to get rid of duplication.

It is almost, but not quite, back-compatible. Most of the changes are just additions. But a couple of obscure features have been removed.

A single, current grammar would work fine for the great majority of users.

KvanTTT commented 4 years ago

Whatever, I think the old grammar can be replaced by the new one.

apjanke commented 4 years ago

Cool; I'll work up an update! This may take a little while since I'm an ANTLR newbie.