Giter Site home page Giter Site logo

parsers's People

Contributors

adam-singer avatar dikmax avatar polux avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

parsers's Issues

Unicode parsers

Current version of alphanum, upper, lower parser accepts only latin chars while Haskell's parsers accept all unicode chars.
I know that Dart doesn't have methods to test char agains unicode class, but we could implement it on our own but we can use http://www.unicode.org/Public/6.3.0/ucd/UnicodeData.txt to generate predicates which work with all unicode chars.

Does it makes sense? Or this shouldn't be part of parsers library?

Dart 2.0 support

Hey,

since strong_mode is working I was thinking Dart 2 is already supported, but if I try to pub get ^1.0.0 of parsers I'll get:

Resolving dependencies...
The current Dart SDK version is 2.0.0.

Because systori depends on parsers >=0.0.2 which requires SDK version <2.0.0, version solving failed.

Explain recursion

The tutorial ends just after a heading for "Recursion". Could you explain how it works?

dynamic is not a subtype of type 'Parser'

Since I updated flutter yesterday I'm always getting this error if I try to execute the full_arith example:
type '() => dynamic' is not a subtype of type '() => Parser'

It seems that there has something changed, or am I wrong?

Exception when parsing multiline // comments in mini_ast.dart

@polux might of found a strange bug.

When trying to parse the first example everything works fine. On the second example the parser blows up with exception. Look at the line // multiline

good

final test = """

// Data core processor package
// Second comment line
[someattribute]
namespace datacore {
  // Defined interface of the processor
  interface DataProc {
    // Loads data for the processor as object array
// multiline
    bool loadData(array data, int size);

    // Loads data for the processor as int array
    void load(int data[]);

    // Executes the processor
    void run();

    /* Returns the result of the processor */
    DataProcResult result();
  };

  /**
   * A data type for the processor result
   * Multi line comment
   * With information. 
   */
  dictionary DataProcResult {
    double timeSpent;

    // Value calculated from processing
    int value;
  };
};
""";

bad

final test = """

// Data core processor package
// Second comment line
[someattribute]
namespace datacore {
  // Defined interface of the processor
  interface DataProc {
    // Loads data for the processor as object array
    // multiline
    bool loadData(array data, int size);

    // Loads data for the processor as int array
    void load(int data[]);

    // Executes the processor
    void run();

    /* Returns the result of the processor */
    DataProcResult result();
  };

  /**
   * A data type for the processor result
   * Multi line comment
   * With information. 
   */
  dictionary DataProcResult {
    double timeSpent;

    // Value calculated from processing
    int value;
  };
};
""";

Exception

Breaking on exception: "line 9, character 5: expected identifier or 'void', got '/'."

Infinite loop?

Sorry for the question, but I don't know where else to put this. Basically, I have this script:

import 'package:parsers/parsers.dart';

class Zinc extends LanguageParsers {
  Zinc(): super(reservedNames: ['let', 'in', 'join', 'cut']);
  get start => prog().between(spaces, eof);
  get comma => char(',') < spaces;
  get lp => symbol('(');
  get rp => symbol(')');
  get lb => symbol('{');
  get rb => symbol('}');
  get colon => symbol(':');
  get dollar => symbol('\$');
  get plus => symbol('+');
  get minus => symbol('-');
  get star => symbol('*');
  get slash => symbol('/');
  get eq => symbol('=');
  get len => symbol('#');
  get in_ => char('E');
  get where => char('W');
  get sort => char('S');

  prog() => (reserved['let'] + decls() + reserved['in'] + expr()).list;
  decls() => decl().sepBy(comma);
  decl() => oprw() | fdecl();
  fdecl() => (identifier + lp + identifier.sepBy(comma) + rp + eq + expr()).list;
  oprw() => (op() + eq + (magicop() | op())).list |
            (identifier.sepBy1(op()) + eq + expr()).list;
  magicop() => reserved['join'] | reserved['cut'];
  basicop() => plus | minus | star | slash | len | eq;
  op() => (basicop() + colon).list | basicop();
  expr() => setcomp() | binop();
  setcomp() => (lb + identifier + in_ + rec(expr) + clause() + rb).list;
  clause() => ((where | sort) + rec(expr)).list;
  binop() => (prim() + op() + expr()) | (dollar + prim());
  prim() => identifier | intLiteral;
}

final test = """
let
in x
""";

void main() {
  print(new Zinc().start.parse(test));
}

I would guess it should work. Except that it DOESN'T. It just loops forever. What am I doing wrong?

Expand docs on Parser

Most of the operators and methods on Parser have cryptic comments. For example:

/// Applicative <*>
Parser operator *(Parser p) => this >> (f) => p >> (x) {
Function ff = f;
return success(ff(x));
};

I think most Dart developers will be entirely mystified by this comment. It would be more user-friendly explain what this operator does without assuming you know Haskell or have read the research papers.

Make special subclass from Parser without expectations.

Some parsers shouldn't have error messages, they always should produce success results. For such parsers caring about expectations is really expensive and unnecessary. Idea is to make some subclass or some flag to exclude everything unneeded. I've tested on my library (just copied and rewrote many, skipMany and choose methods) and parser started working 30% faster.

Strong Mode

Is this project still maintained?

Are there plans to support strong mode in the source so that it works with DDC?

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.