mhagiwara / camxes.js

Lojban Parser written in JavaScript. Based on camxes.
MIT License
15 stars 2 forks source link

Unable to run the parser #4

Open yannis1962 opened 1 year ago

yannis1962 commented 1 year ago

When I run the following code with node:

var PEG = require("pegjs") var fs = require("fs") // read peg and build a parser var camxes_peg = fs.readFileSync("./camxes.js.peg").toString(); var camxes = PEG.buildParser(camxes_peg, {cache: true}); // test it camxes.parse("ko'a broda"); fs.writeFileSync("/path/to/camxes.js", camxes.toSource());

I get:

/Users/yannis/Downloads/LIVRE/PYTHON/EXOS/03-3/run.js:5 var camxes = PEG.buildParser(camxes_peg, {cache: true}); ^

TypeError: PEG.buildParser is not a function at Object. (/Users/yannis/Downloads/LIVRE/PYTHON/EXOS/03-3/run.js:5:18) at Module._compile (node:internal/modules/cjs/loader:1257:14) at Module._extensions..js (node:internal/modules/cjs/loader:1311:10) at Module.load (node:internal/modules/cjs/loader:1115:32) at Module._load (node:internal/modules/cjs/loader:962:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47

Node.js v20.3.1

What am I doing wrong?

Thanks in advance

lagleki commented 1 year ago

I suggest that you use ilmentufa instead

https://github.com/lojban/ilmentufa

yannis1962 commented 1 year ago

Thanks for the advice.

It worked for a relatively short text, but when I try with

ni'o la .dorotis. cu xabju lo midju be lo ganra sastu'a pe la .kanzas. fi'o kansa la nakfamti .xenris. ku noi te cange ku'o .e la fetfamti .em. ku noi speni lo te cange

I get the error message

ni'o la .dorotis. cu xabju lo midju be lo ganra sastu'a pe la .kanzas. fi'o kansa la nakfamti .xenris. ku noi te cange ku'o .e la fetfamti .em. ku noi speni lo te cange ^

SyntaxError: Unexpected token 'i', "ni'o la .do"... is not valid JSON at JSON.parse () at Object.camxes_postprocessing (/Users/yannis/Downloads/LIVRE/PYTHON/EXOS/03-4/ilmentufa-master/camxes_postproc.js:65:40) at run_camxes (/Users/yannis/Downloads/LIVRE/PYTHON/EXOS/03-4/ilmentufa-master/run_camxes.js:135:38) at Object. (/Users/yannis/Downloads/LIVRE/PYTHON/EXOS/03-4/ilmentufa-master/run_camxes.js:90:26) at Module._compile (node:internal/modules/cjs/loader:1257:14) at Module._extensions..js (node:internal/modules/cjs/loader:1311:10) at Module.load (node:internal/modules/cjs/loader:1115:32) at Module._load (node:internal/modules/cjs/loader:962:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47

Node.js v20.3.1

Do you know what I'm doing wrong?

Thanks in advance

Yannis

Le 6 juil. 2023 à 21:11, lagleki @.***> a écrit :

I suggest that you use ilmentufa instead

https://github.com/lojban/ilmentufa

— Reply to this email directly, view it on GitHub https://github.com/mhagiwara/camxes.js/issues/4#issuecomment-1624185188, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFXC7NAVP2QS6BWO7N3GDTXO4EWVANCNFSM6AAAAAA2AVO7XQ. You are receiving this because you authored the thread.

http://www.imt-atlantique.fr/ Yannis HARALAMBOUS Professor Computer Science Department UMR CNRS 6285 Lab-STICC https://www.imt-atlantique.fr/en/person/yannis-haralambous https://twitter.com/y_haralambous https://www.linkedin.com/in/yannis-haralambous-5529073?trk=hp-identity-nameTechnopôle Brest-Iroise CS 83818 29238 Brest Cedex 3, France Une École de l'IMT http://www.imt.fr/

‌...il n'était pas loin de se comparer à celui qui, jadis, avait donné le feu aux humains et auquel d'ailleurs il trouverait un jour un nom, il se le promettait. ‌(Pierre Davy, ‌L'écho des cavernes)‌