Replies: 9 comments 34 replies
-
UAN Logical Instruction SetModel: UAN Format
Description
Partial GrammarUANBlock:
category+=UANCategory*
;
UANCategory:
category=
(
'CATEGORY01' | 'CATEGORY02' |
'CATEGORY03' | 'CATEGORY04' |
'CATEGORY05' | 'CATEGORY06'
) user_names+=UANNames*
;
UANNames:
name=ID
; Partial Validatorexport class LoraxDslValidator {
...
checkUANNamesIsLowerCase(category: UANNames, accept: ValidationAcceptor): void {
if (category.name) {
const name = category.name;
if (name.toLocaleLowerCase() !== name) {
accept('warning', 'UAN names should be lowercase.', { node: category, property: 'name' });
}
}
}
...
} Tag: @msujew This block seems to behave as expected. Mostly verifying the overall approach is sound because this general approach will be used for the rest of the implementation. |
Beta Was this translation helpful? Give feedback.
-
TDB Placeholder |
Beta Was this translation helpful? Give feedback.
-
System Design Block |
Beta Was this translation helpful? Give feedback.
-
Question: Nested Multi-Line Comments As shown above, multi-line comments are pretty straightforward.
Accordingly, the terminal rule is: hidden terminal ML_COMMENT: /\$\>[\s\S]*?\<\$/; Occasionally, there are nested comments (very annoying - but happens) and that is allowed/supported by the DSL syntax.
I figured out the hard way that JavaScript doesn't support recursion |
Beta Was this translation helpful? Give feedback.
-
Question: Development Strategy As I think through how best to tackle this, do you have any recommendations on how to incrementally build out the capability? Ideally, I'd be able to get early prototypes that are somewhat useable into the hands of a larger audience for user feedback and testing. Given the size and scope of the DSL, the breadth of available features within VSCode, and the current capabilities of Langium do you have any recommendations on how best to iteratively and incrementally build up the LSP? There's probably a better way to ask this question, so let me know if it makes sense. |
Beta Was this translation helpful? Give feedback.
-
As of now, the latter one. It might be interesting to implement this as a feature though.
Maybe the langium validator might help you. There are a few validations which are related to uniqueness of names:
Right now, we simply add the
None so far.
You're right. You can override the existing |
Beta Was this translation helpful? Give feedback.
-
Disambiguate Parser Rules:Tags: @msujew Typically I can work my way out of these, but this one is a little more complicated. I get the dreaded Essentially, I need a
What am I missing? Thanks in advance for the help! Desired Grammar...
HorizontalDefinition: // TODO: needs a pretty complicated validator
CircularOption | PointsOption | SpehricalOption
;
CircularOption infers HorizontalDefinition:
'MIN/MAX RNG:' minRng=REAL maxRng=REAL rngUOM=XYUnits
'COUNTERCLOCKWISE' 'FROM:' from=REAL fromUOM=HDGUnits
'TO:' to=REAL toUOM=HDGUnits
;
PointsOption infers HorizontalDefinition:
('X,Y:' x=REAL y=REAL xyUOM=XYUnits)*
;
SpehricalOption infers HorizontalDefinition:
('L/L:' lat=COORDS lon=COORDS)*
;
... Passing Grammar (untested)...
HorizontalDefinition: // TODO: needs a pretty complicated validator
CircularOption | PointsOption | SpehricalOption
;
CircularOption infers HorizontalDefinition:
'MIN/MAX RNG:' minRng=REAL maxRng=REAL rngUOM=XYUnits
'COUNTERCLOCKWISE' 'FROM:' from=REAL fromUOM=HDGUnits
'TO:' to=REAL toUOM=HDGUnits
;
PointsOption infers HorizontalDefinition: // TODO: figure out a better way to structure this
'X,Y:' x=REAL y=REAL xyUOM=XYUnits
'X,Y:' x=REAL y=REAL xyUOM=XYUnits
('X,Y:' x=REAL y=REAL xyUOM=XYUnits)*
;
SpehricalOption infers HorizontalDefinition: // TODO: figure out a better way to structure this
'L/L:' lat=COORDS lon=COORDS
'L/L:' lat=COORDS lon=COORDS
('L/L:' lat=COORDS lon=COORDS)*
;
... |
Beta Was this translation helpful? Give feedback.
-
Strange Issue - Possible Validation Idea@msujew Here's a notional case: someRule:
'foo' name=STRING
('bar' barName=STRING barID=INT)*
(bazRule)*
;
bazRule:
'bar' barName=STRING barID=INT
; Not sure there's any way to cleanly keep you from doing this ... I'll give some thought to what a validation would look like. Since |
Beta Was this translation helpful? Give feedback.
-
DSL Project Workspace - Configuration Management (off-topic)This question is probably somewhat out of scope, but it's relevant since I'm trying to resolve which files to include for scope computation purposes. Essentially, I need some way of managing the project/workspace state (notionally using a config file) since a naive approach of including all files in a particular directory won't work for my use case. On the Langium side, it seems reasonable to initialize the workspace by filtering against a config file (see diagram below). Not sure if there are any preexisting examples ... I know the Domainmodel has example code for specifying the project root. Secondarily, what is a practical way of managing this file or one that's often used in practice? The VSCode Extension API turns into a veritable rabbit hole with numerous options/contribution points (TreeView API, WebView API, Configuration API, etc.). Obviously, this is heavily use-case dependent, but I'm wondering what you guys use as a standard approach? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Disclaimer
Our team consists of engineers and analysts and as such we are not software or language developers; that is, collectively we have very limited practical TypeScript/Javascript experience and cursory, academic (if any) exposure to language design.
The overall intent of this thread is two-fold:
Previous Questions/Comments:
Use-Case
Create developer tooling support for an existing in-house DSL. While current developer/analyst tooling exists, it is limited to generic text editors and a legacy (unused) Emacs plug-in.
(original desc)
DSL Overview & Description
For the purpose of this exercise, we'll refer to this language/DSL as the LORAX (Langium Obvious Required Adoption eXpectations) DSL.
LORAX Language Description:
From the docs (not particularly helpful or insightful) ...
LORAX Model Structure
The first phase of LORAX modeling entails reading and checking the various types of user-generated, model input data (instructions). Specifically, these model inputs/instructions are listed as:
Global Instructions
Each file includes 'global options' at the file header/footer described as:
<logical-instruction-set>
: occurs one or more times, referring to one of the following composite data items:<data-option>
:SAVE-DATA
orDO-NOT-SAVE-DATA
Partial Grammar:
Comments - Terminal Rules
Numeration - TERMINAL Rules?
12.3
0.
.0
0.67
-6.8E4
0.3e-2
Partial Grammar (Terminal Rules)
Units of Measure (UOM) - Keywords?
Examples:
(SEC)
(MIN)
(HR)
(M)
(KM)
(FT)
(MILES)
Logical Instruction Sets (Composite Data Items)
UAN, TDB, and SDB will be captured in separate threads.
LORAX LSP: Objectives & Features
Document the existing DSL grammar definition/rules/syntax and develop validation methods native to VSCode to support real-time developer/analyst feedback during analysis environment development.
NOTE: It's understood that the Langium framework may not provide all of the above features. The intent is to capture the overall list of features available within the VSCode environment and determine what is or is not something to implement within Langium (or possibly features not yet complete).
Tag: @msujew - Please feel free to comment or provide feedback at your convenience. I'll tag you in any specific questions.
Beta Was this translation helpful? Give feedback.
All reactions