can't get grammar to work #913
-
Hello! Taking Langium for a spin. I started with the hello-world project template. When I hit F5, it started the extension host. I made a Next I proceeded to modify my Here's the new definition, in case I'm missing something (VS Code shows no errors): grammar LanguageExperiment
entry Code:
(vars+=LetStatement | fns+=Functionn)*;
LetStatement:
'let' name=ID '=' value=Functionn;
Functionn:
'function' name=ID '(' ID ')' '{' '}';
hidden terminal WS: /\s+/;
terminal ID: /[_a-zA-Z][\w_]*/;
terminal INT returns number: /[0-9]+/;
terminal STRING: /"[^"]*"|'[^']*'/;
hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//;
hidden terminal SL_COMMENT: /\/\/[^\n\r]*/; Here's a sample file in the extension host: let foo = function foo(foo) {}; I see these errors: In a sibling file I still have
and that still works. Why does the hello example still work, although I've changed the grammar? What's wrong with the new grammar (or the sample "code")? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Did you run |
Beta Was this translation helpful? Give feedback.
Did you run
npm run langium:generate
andnpm run build
? The first command will generate TypeScript files for your DSL, and the second command will compile the TypeScript files to build your extension.https://github.com/langium/langium/blob/4115491e39e3eb2ad36cbe4223a02ce212d0ecd0/packages/generator-langium/langium-template/package.json#L37-L44