Git Product home page Git Product logo

mpp-language-blender's Issues

error handling

Sometimes (not always) MPP dies on errors and errors messages are mute, well they shouldn't be. ==> let error messages be!

please provide documentation

At the minimum, we need the following:

  • Each module should have a high level description of what the module is about.
  • Each function and type should be described.

Thanks! This would make it much easier to use MPP.

OCaml 5 friendly version

Currently in Opam it says:

depends      "ocaml" {>= "4.03" & < "5.0.0"} "dune" {> "1.11.0"} "stdlib-shims"

Lexer captures newline after `else`

{{! ifdef foo something !}}
{{! else
  something else
!}}

is invalid because the else command is lexed as "else\n". it seems newline is a valid character in an indentifier and does not count as whitespace. This isn't intuitive.

check if value of variable equals some constant

I want to do:

mpp -set x=true foo.mpp
mpp -set x=false foo.mpp

and then in foo.mpp, do something like

{{if (( get x )) = true
  Got true.
}}
{{if (( get x )) = false
  Got false.
}}

Is there some way to do the above?

ideas_draft

(I'm simply copy-pasting the content of the file ideas_draft.md as I'm in the process of cleaning the repo)

Currently, what is between the opening token and the first following
space is the name of the block. I'm wondering how bad it would be, in
order to avoid that "mandatory space", to consider that names can't be
builtin names. That would allow the space to be optional.

In this context, it would mean that builtin names are sort of keywords...

locations in foreign code: level 2 is missing

Latest version(s) of MPP print locations when using foreign code blocks, and it makes it easier to track errors. But the locations disappear after the foreign code has been evaluated. Evaluation of the foreign code should print source locations. However it's not as trivial as saying it: the format of the location depends on the final language, not the 1st nor the 2nd. But, it should be not too hard to make a version that works with CPP locations. This will probably bump MPP version to 0.2.x. as it will need a few changes in the interface.

library function corresponding to app

Is there a library function corresponding to the main app's functionality? As far as I can tell, it is within mpp_main.ml but not exposed as a callable function. I would like to have the main functionality available with strings as the input/output, rather than files. This would allow more efficient processing in external scripts and avoid having to make messy system calls.

relative file path handling

Consider you have a file in a directory called src/ with the following contents:

$ cat src/foo.mpp
(( input bar.txt ))

Currently, the file bar.txt is searched relative to the current working directory of whatever process you're calling mpp from. I think it would be more intuitive if the path was interpreted as relative to src/, i.e. the directory in which the mpp file resides.

One issue with this is related to my request in #7 for a library function corresponding to the command line app. If you provide a function val mpp_on_string : string -> string, which directly operates on a string, then you don't have a file path to get the parent directory from. A solution could be to have such a function also take an optional filename argument. If this argument is not provided, then you fallback to using the current working directory.

Stack overflow

From the root of the ocaml.org repository, the following command

mpp -so '((!' -sc '!))' -son '{{!' -scn '!}}' -soc '' -scc '' -sec '' -sos '{{<' -scs '>}}' -its template/main.mpp -o /tmp/c.html -set "filename=x" -set "page=/tmp/preprocessed_99problems.html"

terminates with the exception Stack_overflow where /tmp/preprocessed_99problems.html is the result of processing the file site/learn/tutorials/99problems.md with omd.

Does MPP escape the command properly?

If I run

mpp -so '((!' -sc '!))' -son '{{!' -scn '!}}' -soc '' -scc '' -sec '' -sos '{{<' -scs '>}}' -its  -set "filename=site/index.md" -set "page=ocaml.org/index.html.tmp" tpl/main.mpp -o "ocaml.org/index.html" 

in a terminal, I get

sh: 1: Syntax error: redirection unexpected

The strings are properly escaped. Is it possible that the problem comes from mpp trying to execute commands and not escaping properly the arguments? (No time to investigate right now)

Errors should identify the program

When mpp is used in scripts, it is not always clear what the origin of an error is. Thus MPP should identify itself in error messages.

bash output adds new lines

The bash language output uses echo, so it adds new-lines.

{
cat <<EOF
hello {< printf "world" >}!
EOF
} | mpp -l bash | bash

gives

hello 
world!

Instead of echo ... it could use printf '%s' ... (it's POSIX sh).

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.