123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import {
- InputStream,
- CommonTokenStream
- } from 'antlr4/index';
- import { IVProgParser } from './ast/ivprogParser';
- import Lexers from '../grammar/';
- const lang = 'pt_br';
- const ivprogLexer = Lexers[lang];
- const input = `programa {
- const real PI = 5.5
- inteiro V = -10*2
- funcao inteiro test(real i) {
- escolha (i) {
- caso 1:
- retorne 0
- caso contrario:
- retorne 4
- }
- }
- }`;
- const anaSin = new IVProgParser(input, ivprogLexer);
- try {
- console.log(anaSin.parseTree());
- } catch(a) {
- console.log(a);
- }
|