Coder Social home page Coder Social logo

faustinoaq / vscode-lex-flex-yacc-bison Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 71.0 194 KB

Syntax highlighting for Lex, Flex, Yacc and Bison in VSCode.

Home Page: https://marketplace.visualstudio.com/items?itemName=faustinoaq.lex-flex-yacc-bison

License: MIT License

vscode-extension

vscode-lex-flex-yacc-bison's Introduction

Lex Flex Yacc Bison

Syntax highlighting for Lex, Flex, Yacc and Bison.

This extension is based on these extensions:

  1. Lex/Flex
  2. Yacc/Bison

Example

Overview

A compiler or interpreter for a programming language is often decomposed into two parts:

  1. Read the source program and discover its structure.
  2. Process this structure, e.g. to generate the target program.

Lex and Yacc can generate program fragments that solve the first task.

The task of discovering the source structure again is decomposed into subtasks:

  1. Split the source file into tokens (Lex).
  2. Find the hierarchical structure of the program (Yacc).

Read more in Lex & Yacc Page

Known Issues

Some keywords aren't detected.

Release Notes

See Change Log.

Contributing

  1. Fork it https://github.com/faustinoaq/vscode-lex-flex-yacc-bison/fork
  2. Create your feature branch git checkout -b my-new-feature
  3. Commit your changes git commit -am 'Add some feature'
  4. Push to the branch git push origin my-new-feature
  5. Create a new Pull Request

Contributors

vscode-lex-flex-yacc-bison's People

Contributors

faustinoaq avatar filipejsfreitas avatar kjmitch avatar pjalali avatar rakesh-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vscode-lex-flex-yacc-bison's Issues

Broken Syntax Highlight after '('

Using the extension I found a bug in the syntax highlight. It looks like it is broken after a ( character, see the screenshot:

Screenshot from 2019-05-14 20-51-28

Here is the plain code to copy and paste:

%option yylineno
%option nounput
%option noinput
%option nodefault

%{
#include "minako.h"
%}

%%
{whitespace}+ { /* nothing */ }

","           { return ','; } 
";"           { return ';'; } 
"("           { return '('; } 
")"           { return ')'; } 
"{"           { return '{'; } 
"}"           { return '}'; } 

<<EOF>>       { return EOF; }
%%

Unfortunately I was not able to fix the problem.

Does not support .lex extension

In my compilation course (and from what I see online) .lex extension is pretty common for lex files.
Should add support for this extension in a future update.

FR: please co-publish on Open VSX Registry

Please add this useful extension to the Open VSX Registry, which currently includes an outdated fork of this extension.

Details on the publishing can be found at https://github.com/eclipse/openvsx/wiki/Publishing-Extensions.

A bit of explanation:
Open VSX Registry is the default extension provider endpoint for several free builds of vscode like VSCodium and also gitpod and also for Eclipse Theia. It would be nice to have this extension directly be published to a free vsix repository, instead of only publishing it to the Microsoft Marketplace with its restrictions.

You could also use a GitHub action that allows publishing to Open VSX and the MS market place, HaaLeo/publish-vscode-extension does this.

Flex - Not recognising

Not highlighting correctly start condition scope as presented on flex manual here (pg. 25):
image

below program works fine:
image

Add extra lex file suffixes equivalent to the yacc suffixes

The extension currently recognises lex / flex suffixes ".l" and ".flex"
while for yacc / bison it recognises ".y", ".yy", ".ypp", ".yxx", ".y++" and ".bison" / ".BISON"

Consider extending the set of lex suffixes recognised similarly:

.l, .ll, .l++, .lxx, and .lpp

See, for example, autotools yacc & lex docs:

Similarly, lex source files can be used to generate C or C++; the extensions .l, .ll, .l++, .lxx, and .lpp are recognized.

Workaround: change language mode to flex / lex:
Ctrl-Shift-P -> "Change Language Mode" -> Flex/lex

$$ is not highlighted

Some keywords like $$ is not highlighted when I open a bison file. And it is weird that some C code is highlighted normally and some isn't. Did I do something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.