Replies: 2 comments
-
Sorry for not responding earlier to this question. I needed to research the status of the TypeScript language specification to see what can be done. Unfortunately, there is no language spec for TypeScript. There was at one point a grammar here, but it was removed with this PR. The people at MS do not seem to understand that a bunch of web pages, which are constantly changing, and not marked with version numbers, does not constitute a "specification." In fact, the grammar that was used is completely replaced with natural language descriptions. Typescript is a super-set of ECMAScript, which does have a formal specification at the ECMA website. This spec is excellent, and amenable to automatic scraping. We then just need to scrape this spec and add/replace all the rules associated with Typescript. But, without a spec, this is going to be hard. The current typescript grammar has not kept up with the ECMAScript standard, let alone new Typescript features. The ecmascript grammar is in a similar situation. I think the first place to start will be to update the ecmascript grammar with a scraped, then modified--using automated refactorings in Trash--to come up with a modern ecmascript grammar. |
Beta Was this translation helpful? Give feedback.
-
First rudimentary scraper of ECMAScript grammar from the official language specification here. The code reads the web and extracts a pseudo-Antlr EBNF grammar. This will need to be refactored to be in Antlr4 grammar syntax, and even more refactoring to be usable. But, because the spec is extremely well done, we can get the grammar from any version of the spec. |
Beta Was this translation helpful? Give feedback.
-
Hi,
As far as I could check, the antlr4 typescript grammar has not "keyof" keyword.
Since that keyword was added in version 2.1 of the language (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html) I presume that the antlr4 grammar is at most on version 2.0.
Beta Was this translation helpful? Give feedback.
All reactions