Skip to content

solanav/ezreq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EZReq

External DSL to learn about OCaml and compilers. It should make it easier to make scrappers.

Compiles to Python.

How to run

Compile EZReq:

make

Compile the source code:

 ./ezreq examples/test.ezr

Run the code:

python3 examples/test.py

Example

Source Code (examples/test.ezr):

begin
    title = get "https://example.org"
    |> extract "<title>" "</title>"
    |> print
end

Compiled program:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" File automatically generated by Ezreq """
def print_ezreq(var):
    try:
        print(var.text)
    except AttributeError:
        print(var)

import requests

title = requests.get("https://example.org")
pipe_tmp = title
pipe_tmp = pipe_tmp.text.split("<title>")[1].split("</title>")[0]
print_ezreq(pipe_tmp)
title = pipe_tmp

exit(0)

Result:

Example Domain
https://www.iana.org/domains/example

About

External DSL to learn about OCaml and compilers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published