Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃毀 Browser support #413

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

M-Adoo
Copy link

@M-Adoo M-Adoo commented Mar 28, 2019

Let antlr4ts work in browser.

  • compile typescript to es5 target
  • provide umd銆乧js and es bundles.
  • some file circle dependency has be resolved.

todo: commits need be rebase -i

@M-Adoo
Copy link
Author

M-Adoo commented Mar 28, 2019

maybe resolved #343

@albyrock87
Copy link

@M-Adoo thank you for trying to do this, but I found some issues.

  1. Rollup found a lot of circular dependencies:
(!) rpt2 plugin: The ongenerate hook used by plugin rpt2 is deprecated. The generateBundle hook should be used instead.
(!) rpt2 plugin: The onwrite hook used by plugin rpt2 is deprecated. The generateBundle hook should be used instead.
(!) Circular dependency: src\atn\ATN.ts -> src\dfa\DFA.ts -> src\atn\ATNConfigSet.ts -> src\atn\ATN.ts
(!) Circular dependency: src\atn\PredictionContext.ts -> src\atn\PredictionContextCache.ts -> src\atn\PredictionContext.ts
(!) Circular dependency: src\atn\ATN.ts -> src\dfa\DFA.ts -> src\dfa\DFASerializer.ts -> src\atn\ATNSimulator.ts -> src\dfa\DFAState.ts -> src\atn\ATN.ts
(!) Circular dependency: src\misc\IntervalSet.ts -> src\Lexer.ts -> src\atn\LexerATNSimulator.ts -> src\atn\ATN.ts -> src\misc\IntervalSet.ts
(!) Circular dependency: src\misc\IntervalSet.ts -> src\Lexer.ts -> src\atn\LexerATNSimulator.ts -> src\atn\ATN.ts -> src\atn\LL1Analyzer.ts -> src\misc\IntervalSet.ts
(!) Circular dependency: src\misc\IntervalSet.ts -> src\Lexer.ts -> src\atn\LexerATNSimulator.ts -> src\atn\ATN.ts -> src\atn\LL1Analyzer.ts -> src\atn\NotSetTransition.ts -> src\atn\SetTransition.ts -> src\misc\IntervalSet.ts
(!) Circular dependency: src\Lexer.ts -> src\atn\LexerATNSimulator.ts -> src\Lexer.ts
(!) Circular dependency: src\NoViableAltException.ts -> src\Parser.ts -> src\atn\ATNDeserializer.ts -> src\atn\ParserATNSimulator.ts -> src\NoViableAltException.ts
(!) Circular dependency: src\Parser.ts -> src\atn\ATNDeserializer.ts -> src\atn\ParserATNSimulator.ts -> src\ParserRuleContext.ts -> src\RuleContext.ts -> src\tree\Trees.ts -> src\Parser.ts
(!) Circular dependency: src\ParserRuleContext.ts -> src\RuleContext.ts -> src\tree\Trees.ts -> src\ParserRuleContext.ts
(!) Circular dependency: src\ParserRuleContext.ts -> src\RuleContext.ts -> src\ParserRuleContext.ts
(!) Circular dependency: src\DefaultErrorStrategy.ts -> src\NoViableAltException.ts -> src\Parser.ts -> src\DefaultErrorStrategy.ts
(!) Circular dependency: src\tree\xpath\XPath.ts -> src\tree\xpath\XPathWildcardAnywhereElement.ts -> src\tree\xpath\XPath.ts
(!) Circular dependency: src\tree\xpath\XPath.ts -> src\tree\xpath\XPathWildcardElement.ts -> src\tree\xpath\XPath.ts
(!) Circular dependency: src\Parser.ts -> src\atn\index.ts -> src\atn\ProfilingATNSimulator.ts -> src\Parser.ts
(!) Circular dependency: src\Parser.ts -> src\tree\pattern\index.ts -> src\tree\pattern\ParseTreePatternMatcher.ts -> src\Parser.ts
(!) Circular dependency: src\BailErrorStrategy.ts -> src\DefaultErrorStrategy.ts -> src\NoViableAltException.ts -> src\Parser.ts -> src\index.ts -> src\BailErrorStrategy.ts
(!) Circular dependency: src\DefaultErrorStrategy.ts -> src\NoViableAltException.ts -> src\Parser.ts -> src\index.ts -> src\DefaultErrorStrategy.ts
(!) Circular dependency: src\NoViableAltException.ts -> src\Parser.ts -> src\index.ts -> src\NoViableAltException.ts
(!) Circular dependency: src\Parser.ts -> src\index.ts -> src\Parser.ts
(!) Circular dependency: src\Parser.ts -> src\index.ts -> src\ParserInterpreter.ts -> src\Parser.ts
  1. Generated (by using the tool) Lexer and Parser files don't use the UMD bundle

Thank you so much!

@sharwell
Copy link
Member

sharwell commented Mar 30, 2019

@M-Adoo I'm well aware that this is a daunting task. I imagine it will take many tries to figure out a clean way to implement it even to a point where the current set of tests work. I will leave this pull request open while you continue to work on it. Due to the complexities involved and the specific goal of "supporting browsers", once we get the tests passing in the CI build (which uses Node), I would value your thoughts on how we can correctly test the code in the context of supported browsers.

@sharwell sharwell changed the title Browser support 馃毀 Browser support Mar 30, 2019
@M-Adoo
Copy link
Author

M-Adoo commented Mar 31, 2019

A good news is we had already used antlr4ts in browser. I will finish the rest of the work for this pr when I have time. Thanks nice job of anrlr4ts members.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Browser Support
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

3 participants